forked from lodash/lodash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrangeRight.js
39 lines (37 loc) · 815 Bytes
/
rangeRight.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import createRange from './.internal/createRange.js'
/**
* This method is like `range` except that it populates values in
* descending order.
*
* @since 4.0.0
* @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 range of numbers.
* @see inRange, range
* @example
*
* rangeRight(4)
* // => [3, 2, 1, 0]
*
* rangeRight(-4)
* // => [-3, -2, -1, 0]
*
* rangeRight(1, 5)
* // => [4, 3, 2, 1]
*
* rangeRight(0, 20, 5)
* // => [15, 10, 5, 0]
*
* rangeRight(0, -4, -1)
* // => [-3, -2, -1, 0]
*
* rangeRight(1, 4, 0)
* // => [1, 1, 1]
*
* rangeRight(0)
* // => []
*/
const rangeRight = createRange(true)
export default rangeRight