1 var toInteger = require('./toInteger'),
2 toLength = require('./toLength');
5 * The base implementation of `_.fill` without an iteratee call guard.
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`.
14 function baseFill(array, value, start, end) {
15 var length = array.length;
17 start = toInteger(start);
19 start = -start > length ? 0 : (length + start);
21 end = (end === undefined || end > length) ? length : toInteger(end);
25 end = start > end ? 0 : toLength(end);
27 array[start++] = value;
32 module.exports = baseFill;