source: trip-planner-front/node_modules/lodash/_createRange.js@ 84d0fbb

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

initial commit

  • Property mode set to 100644
File size: 864 bytes
Line 
1var baseRange = require('./_baseRange'),
2 isIterateeCall = require('./_isIterateeCall'),
3 toFinite = require('./toFinite');
4
5/**
6 * Creates a `_.range` or `_.rangeRight` function.
7 *
8 * @private
9 * @param {boolean} [fromRight] Specify iterating from right to left.
10 * @returns {Function} Returns the new range function.
11 */
12function createRange(fromRight) {
13 return function(start, end, step) {
14 if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
15 end = step = undefined;
16 }
17 // Ensure the sign of `-0` is preserved.
18 start = toFinite(start);
19 if (end === undefined) {
20 end = start;
21 start = 0;
22 } else {
23 end = toFinite(end);
24 }
25 step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
26 return baseRange(start, end, step, fromRight);
27 };
28}
29
30module.exports = createRange;
Note: See TracBrowser for help on using the repository browser.