https://github.com/ryanve/all-filler
Fill function for arrays or strings based on array.fill
https://github.com/ryanve/all-filler
javascript module utility
Last synced: 9 months ago
JSON representation
Fill function for arrays or strings based on array.fill
- Host: GitHub
- URL: https://github.com/ryanve/all-filler
- Owner: ryanve
- License: mit
- Created: 2017-02-11T12:32:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T23:51:20.000Z (over 8 years ago)
- Last Synced: 2025-09-29T04:26:24.097Z (9 months ago)
- Topics: javascript, module, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/all-filler
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# all-filler
Cross-platform fill function based on `Array.prototype.fill` for arrays or strings
```
npm install all-filler
```
## Usage
```js
const fill = require("all-filler")
```
### strings
```js
fill("012", 7) // "777"
fill("012", 7, -1) // "017"
fill("012", 7, 0, 1) // "712"
```
### arrays
```js
fill([0, 1, 2], 7) // [7, 7, 7]
fill([0, 1, 2], 7, -1) // [0, 1, 7]
fill([0, 1, 2], 7, 0, 1) // [7, 1, 2]
```