source: imaps-frontend/node_modules/lodash-es/_createRange.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 862 bytes
Line 
1import baseRange from './_baseRange.js';
2import isIterateeCall from './_isIterateeCall.js';
3import toFinite from './toFinite.js';
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
30export default createRange;
Note: See TracBrowser for help on using the repository browser.