source: imaps-frontend/node_modules/lodash-es/_baseFill.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: 841 bytes
Line 
1import toInteger from './toInteger.js';
2import toLength from './toLength.js';
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
32export default baseFill;
Note: See TracBrowser for help on using the repository browser.