1 |
3a515b92
|
cagy
|
var createRange = require('./_createRange');
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Creates an array of numbers (positive and/or negative) progressing from
|
5 |
|
|
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
6 |
|
|
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
7 |
|
|
* it's set to `start` with `start` then set to `0`.
|
8 |
|
|
*
|
9 |
|
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
10 |
|
|
* floating-point values which can produce unexpected results.
|
11 |
|
|
*
|
12 |
|
|
* @static
|
13 |
|
|
* @since 0.1.0
|
14 |
|
|
* @memberOf _
|
15 |
|
|
* @category Util
|
16 |
|
|
* @param {number} [start=0] The start of the range.
|
17 |
|
|
* @param {number} end The end of the range.
|
18 |
|
|
* @param {number} [step=1] The value to increment or decrement by.
|
19 |
|
|
* @returns {Array} Returns the range of numbers.
|
20 |
|
|
* @see _.inRange, _.rangeRight
|
21 |
|
|
* @example
|
22 |
|
|
*
|
23 |
|
|
* _.range(4);
|
24 |
|
|
* // => [0, 1, 2, 3]
|
25 |
|
|
*
|
26 |
|
|
* _.range(-4);
|
27 |
|
|
* // => [0, -1, -2, -3]
|
28 |
|
|
*
|
29 |
|
|
* _.range(1, 5);
|
30 |
|
|
* // => [1, 2, 3, 4]
|
31 |
|
|
*
|
32 |
|
|
* _.range(0, 20, 5);
|
33 |
|
|
* // => [0, 5, 10, 15]
|
34 |
|
|
*
|
35 |
|
|
* _.range(0, -4, -1);
|
36 |
|
|
* // => [0, -1, -2, -3]
|
37 |
|
|
*
|
38 |
|
|
* _.range(1, 4, 0);
|
39 |
|
|
* // => [1, 1, 1]
|
40 |
|
|
*
|
41 |
|
|
* _.range(0);
|
42 |
|
|
* // => []
|
43 |
|
|
*/
|
44 |
|
|
var range = createRange();
|
45 |
|
|
|
46 |
|
|
module.exports = range;
|