array-fill

1.2.0 • Public • Published

array-fill Build Status

Polyfill for Array.prototype.fill.

testling badge

Usage

Functionally:

var fill = require('array-fill');
 
console.log(fill([1, 2, 3], 4));
// => [ 4, 4, 4 ]
 
console.log(fill([1, 2, 3], 4, 1));
// => [ 1, 4, 4 ]

From Array object:

require('array-fill/shim');
 
var array = [1, 2, 3];
array.fill(4, -3, -2);
 
console.log(array);
// => [ 4, 2, 3 ]

License

MIT © Shogo Sensui

Dependents (0)

Package Sidebar

Install

npm i array-fill

Weekly Downloads

266

Version

1.2.0

License

MIT

Last publish

Collaborators

  • 1000ch