source: trip-planner-front/node_modules/lodash/_baseRange.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 850 bytes
Line 
1/* Built-in method references for those with the same name as other `lodash` methods. */
2var nativeCeil = Math.ceil,
3 nativeMax = Math.max;
4
5/**
6 * The base implementation of `_.range` and `_.rangeRight` which doesn't
7 * coerce arguments.
8 *
9 * @private
10 * @param {number} start The start of the range.
11 * @param {number} end The end of the range.
12 * @param {number} step The value to increment or decrement by.
13 * @param {boolean} [fromRight] Specify iterating from right to left.
14 * @returns {Array} Returns the range of numbers.
15 */
16function baseRange(start, end, step, fromRight) {
17 var index = -1,
18 length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
19 result = Array(length);
20
21 while (length--) {
22 result[fromRight ? length : ++index] = start;
23 start += step;
24 }
25 return result;
26}
27
28module.exports = baseRange;
Note: See TracBrowser for help on using the repository browser.