From 5a451ac5ab23a6a71b47c1e8b66b0dd1b36d5b64 Mon Sep 17 00:00:00 2001 From: Javi Velasco Date: Sat, 5 Sep 2015 02:10:47 +0200 Subject: [PATCH] Disable linting of parameter reassignation --- .eslintrc | 2 +- components/util/helper.js | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) 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;