Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-27T23:51:20.000Z (almost 7 years ago)
- Last Synced: 2024-10-14T04:22:56.657Z (3 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]
```