array-fill

Polyfill for Array.prototype.fill

Downloads
1.4K
Stars
7
Committers
2

array-fill Build Status

Polyfill for Array.prototype.fill.

Install

$ npm install --save-dev array-fill

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

Package Rankings
Top 6.14% on Npmjs.org
Top 22.8% on Bower.io
Badges
Extracted from project README
Build Status testling badge