diff --git a/src/style-spec/error/validation_error.js b/src/style-spec/error/validation_error.js index 5a55e34652e..dce87fab40d 100644 --- a/src/style-spec/error/validation_error.js +++ b/src/style-spec/error/validation_error.js @@ -2,11 +2,8 @@ const format = require('util').format; -function ValidationError(key, value /*, message, ...*/) { - this.message = ( - (key ? `${key}: ` : '') + - format.apply(format, Array.prototype.slice.call(arguments, 2)) - ); +function ValidationError(key, value, ...args) { + this.message = (key ? `${key}: ` : '') + format.apply(format, args); if (value !== null && value !== undefined && value.__line__) { this.line = value.__line__; diff --git a/src/style-spec/function/index.js b/src/style-spec/function/index.js index 1a72e9de524..7a22b919cbe 100644 --- a/src/style-spec/function/index.js +++ b/src/style-spec/function/index.js @@ -196,9 +196,9 @@ function evaluateExponentialFunction(parameters, propertySpec, input) { const interp = interpolate[propertySpec.type] || identityFunction; if (typeof outputLower === 'function') { - return function() { - const evaluatedLower = outputLower.apply(undefined, arguments); - const evaluatedUpper = outputUpper.apply(undefined, arguments); + return function(...args) { + const evaluatedLower = outputLower.apply(undefined, args); + const evaluatedUpper = outputUpper.apply(undefined, args); // Special case for fill-outline-color, which has no spec default. if (evaluatedLower === undefined || evaluatedUpper === undefined) { return undefined; diff --git a/src/style-spec/util/extend.js b/src/style-spec/util/extend.js index a3a746cad40..3e1efd69ccb 100644 --- a/src/style-spec/util/extend.js +++ b/src/style-spec/util/extend.js @@ -1,8 +1,7 @@ 'use strict'; -module.exports = function (output) { - for (let i = 1; i < arguments.length; i++) { - const input = arguments[i]; +module.exports = function (output, ...inputs) { + for (const input of inputs) { for (const k in input) { output[k] = input[k]; } diff --git a/src/util/util.js b/src/util/util.js index 54bf987487c..a52c1361289 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -139,13 +139,11 @@ exports.keysDifference = function (obj: {[key: string]: mixed}, other: {[key: st * source objects. * * @param dest destination object - * @param {...Object} sources sources from which properties are pulled + * @param sources sources from which properties are pulled * @private */ -// eslint-disable-next-line no-unused-vars -exports.extend = function (dest: Object, source0: Object, source1?: Object, source2?: Object): Object { - for (let i = 1; i < arguments.length; i++) { - const src = arguments[i]; +exports.extend = function (dest: Object, ...sources: Array): Object { + for (const src of sources) { for (const k in src) { dest[k] = src[k]; }