diff --git a/components/util/helper.js b/components/util/helper.js new file mode 100644 index 00000000..0f375411 --- /dev/null +++ b/components/util/helper.js @@ -0,0 +1,19 @@ +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); + let range = Array(length); + + for (const idx = 0; idx < length; idx++, start += step) { + range[idx] = start; + } + + return range; + } + +};