MCPcopy
hub / github.com/lodash/lodash / baseFill

Function baseFill

lodash.js:2933–2949  ·  view source on GitHub ↗

* The base implementation of `_.fill` without an iteratee call guard. * * @private * @param {Array} array The array to fill. * @param {*} value The value to fill `array` with. * @param {number} [start=0] The start position. * @param {number} [end=array.length] The end p

(array, value, start, end)

Source from the content-addressed store, hash-verified

2931 * @returns {Array} Returns `array`.
2932 */
2933 function baseFill(array, value, start, end) {
2934 var length = array.length;
2935
2936 start = toInteger(start);
2937 if (start < 0) {
2938 start = -start > length ? 0 : (length + start);
2939 }
2940 end = (end === undefined || end > length) ? length : toInteger(end);
2941 if (end < 0) {
2942 end += length;
2943 }
2944 end = start > end ? 0 : toLength(end);
2945 while (start < end) {
2946 array[start++] = value;
2947 }
2948 return array;
2949 }
2950
2951 /**
2952 * The base implementation of `_.filter` without support for iteratee shorthands.

Callers 1

fillFunction · 0.85

Calls 2

toIntegerFunction · 0.85
toLengthFunction · 0.85

Tested by

no test coverage detected