Sha256: 2de1eb3a1c4b59e46a22a8cfffa5eeaa70c46a36c2c8ddc928744606d25e17f9

Contents?: true

Size: 1.04 KB

Versions: 153

Compression:

Stored size: 1.04 KB

Contents

var baseFill = require('../internal/baseFill'),
    isIterateeCall = require('../internal/isIterateeCall');

/**
 * Fills elements of `array` with `value` from `start` up to, but not
 * including, `end`.
 *
 * **Note:** This method mutates `array`.
 *
 * @static
 * @memberOf _
 * @category Array
 * @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 position.
 * @returns {Array} Returns `array`.
 * @example
 *
 * var array = [1, 2, 3];
 *
 * _.fill(array, 'a');
 * console.log(array);
 * // => ['a', 'a', 'a']
 *
 * _.fill(Array(3), 2);
 * // => [2, 2, 2]
 *
 * _.fill([4, 6, 8], '*', 1, 2);
 * // => [4, '*', 8]
 */
function fill(array, value, start, end) {
  var length = array ? array.length : 0;
  if (!length) {
    return [];
  }
  if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
    start = 0;
    end = length;
  }
  return baseFill(array, value, start, end);
}

module.exports = fill;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/array/fill.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/fill.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/array/fill.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/array/fill.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/array/fill.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/fill.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/array/fill.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/array/fill.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/fill.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/fill.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/fill.js