CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
fill.js46 linesDownload Raw Back to lodash
1var baseFill = require('./_baseFill'),2    isIterateeCall = require('./_isIterateeCall');3 4/**5 * Fills elements of `array` with `value` from `start` up to, but not6 * including, `end`.7 *8 * **Note:** This method mutates `array`.9 *10 * @static11 * @memberOf _12 * @since 3.2.013 * @category Array14 * @param {Array} array The array to fill.15 * @param {*} value The value to fill `array` with.16 * @param {number} [start=0] The start position.17 * @param {number} [end=array.length] The end position.18 * @returns {Array} Returns `array`.19 * @example20 *21 * var array = [1, 2, 3];22 *23 * _.fill(array, 'a');24 * console.log(array);25 * // => ['a', 'a', 'a']26 *27 * _.fill(Array(3), 2);28 * // => [2, 2, 2]29 *30 * _.fill([4, 6, 8, 10], '*', 1, 3);31 * // => [4, '*', '*', 10]32 */33function fill(array, value, start, end) {34  var length = array == null ? 0 : array.length;35  if (!length) {36    return [];37  }38  if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {39    start = 0;40    end = length;41  }42  return baseFill(array, value, start, end);43}44 45module.exports = fill;46 
basant307/AI_Governance_Project · CoolFace