Immutable Array.prototype.fill.


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
582Oct 25, 2019Jun 23, 2017Minified + gzip package size for @immutable-array/fill in KB



Immutable Array.prototype.fill().


Install with npm:

npm install @immutable-array/fill


Same API with Array.prototype.fill().

 * Returns the this object after filling the section identified by start and end with value
 * @param array base array
 * @param value value to fill array section with
 * @param start index to start filling the array at. If start is negative, it is treated as
 * length+start where length is the length of the array.
 * @param end index to stop filling the array at. If end is negative, it is treated as
 * length+end.
export declare function fill<T>(array: Array<T>, value: T, start?: number, end?: number): Array<T>;


import { fill } from "@immutable-array/fill" 
const originalArray = [1, 2, 3];
assert.deepStrictEqual(fill(originalArray, "x"), ["x", "x", "x"]);
assert.deepStrictEqual(fill(originalArray, "x", 1, 2), [1, "x", 3]);


See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test


Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D



MIT © azu

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.