diff --git a/src/scripts/services/util.js b/src/scripts/services/util.js index 01435ce..ac5428e 100644 --- a/src/scripts/services/util.js +++ b/src/scripts/services/util.js @@ -2,25 +2,26 @@ export default class Util { /** * Extend an array just like JQuery's extend. + * @param {...object} var_args Objects to be merged. * @returns {object} Merged objects. */ - static extend() { - for (let i = 1; i < arguments.length; i++) { - for (let key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + static extend(var_args) { + for (let i = 1; i < var_args.length; i++) { + for (let key in var_args[i]) { + if (Object.prototype.hasOwnProperty.call(var_args[i], key)) { if ( - typeof arguments[0][key] === 'object' && - typeof arguments[i][key] === 'object' + typeof var_args[0][key] === 'object' && + typeof var_args[i][key] === 'object' ) { - this.extend(arguments[0][key], arguments[i][key]); + this.extend(var_args[0][key], var_args[i][key]); } else { - arguments[0][key] = arguments[i][key]; + var_args[0][key] = var_args[i][key]; } } } } - return arguments[0]; + return var_args[0]; } /** @@ -137,7 +138,7 @@ export default class Util { */ static callOnceVisible(dom, callback) { if (typeof dom !== 'object' || typeof callback !== 'function') { - return; // Invalid arguments + return; // Invalid var_args } // iOS is behind ... Again ...