diff --git a/.eslintrc b/.eslintrc index e3b7d26f..f6937596 100644 --- a/.eslintrc +++ b/.eslintrc @@ -112,8 +112,8 @@ "no-obj-calls": [2], "no-octal": [2], "no-octal-escape": [2], - "no-param-reassign": [2], "no-path-concat": [0], + "no-param-reassign": [2], "no-plusplus": [0], "no-process-env": [0], "no-process-exit": [2], diff --git a/components/util/helper.js b/components/util/helper.js index 0f375411..12702b7c 100644 --- a/components/util/helper.js +++ b/components/util/helper.js @@ -1,16 +1,12 @@ module.exports = { - range (start, stop, step = 1) { - if (stop == null) { - stop = start || 0; - start = 0; - } - - let length = Math.max(Math.ceil((stop - start) / step), 0); + range (start = 0, stop = null, step = 1) { + let [_start, _stop] = (stop !== null) ? [start, stop] : [0, start]; + let length = Math.max(Math.ceil((_stop - _start) / step), 0); let range = Array(length); - for (const idx = 0; idx < length; idx++, start += step) { - range[idx] = start; + for (let idx = 0; idx < length; idx++, _start += step) { + range[idx] = _start; } return range;