mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Bump to v4.0.0.
This commit is contained in:
45
range.js
Normal file
45
range.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import createRange from './internal/createRange';
|
||||
|
||||
/**
|
||||
* Creates an array of numbers (positive and/or negative) progressing from
|
||||
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
||||
* `start` is specified without an `end` or `step`. If `end` is not specified
|
||||
* it's set to `start` with `start` then set to `0`. If `end` is less than
|
||||
* `start` a zero-length range is created unless a negative `step` is specified.
|
||||
*
|
||||
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
||||
* floating-point values which can produce unexpected results.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Util
|
||||
* @param {number} [start=0] The start of the range.
|
||||
* @param {number} end The end of the range.
|
||||
* @param {number} [step=1] The value to increment or decrement by.
|
||||
* @returns {Array} Returns the new array of numbers.
|
||||
* @example
|
||||
*
|
||||
* _.range(4);
|
||||
* // => [0, 1, 2, 3]
|
||||
*
|
||||
* _.range(-4);
|
||||
* // => [0, -1, -2, -3]
|
||||
*
|
||||
* _.range(1, 5);
|
||||
* // => [1, 2, 3, 4]
|
||||
*
|
||||
* _.range(0, 20, 5);
|
||||
* // => [0, 5, 10, 15]
|
||||
*
|
||||
* _.range(0, -4, -1);
|
||||
* // => [0, -1, -2, -3]
|
||||
*
|
||||
* _.range(1, 4, 0);
|
||||
* // => [1, 1, 1]
|
||||
*
|
||||
* _.range(0);
|
||||
* // => []
|
||||
*/
|
||||
var range = createRange();
|
||||
|
||||
export default range;
|
||||
Reference in New Issue
Block a user