source: trip-planner-front/node_modules/lodash/_baseFill.js@ 6a3a178

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

initial commit

  • Property mode set to 100644
File size: 843 bytes
Line 
1var toInteger = require('./toInteger'),
2 toLength = require('./toLength');
3
4/**
5 * The base implementation of `_.fill` without an iteratee call guard.
6 *
7 * @private
8 * @param {Array} array The array to fill.
9 * @param {*} value The value to fill `array` with.
10 * @param {number} [start=0] The start position.
11 * @param {number} [end=array.length] The end position.
12 * @returns {Array} Returns `array`.
13 */
14function baseFill(array, value, start, end) {
15 var length = array.length;
16
17 start = toInteger(start);
18 if (start < 0) {
19 start = -start > length ? 0 : (length + start);
20 }
21 end = (end === undefined || end > length) ? length : toInteger(end);
22 if (end < 0) {
23 end += length;
24 }
25 end = start > end ? 0 : toLength(end);
26 while (start < end) {
27 array[start++] = value;
28 }
29 return array;
30}
31
32module.exports = baseFill;
Note: See TracBrowser for help on using the repository browser.