
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
repeat-element
Advanced tools
Create an array by repeating the given value n times.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install with npm:
$ npm install --save repeat-element
const repeat = require('repeat-element');
repeat('a', 5);
//=> ['a', 'a', 'a', 'a', 'a']
repeat('a', 1);
//=> ['a']
repeat('a', 0);
//=> []
repeat(null, 5)
//» [ null, null, null, null, null ]
repeat({some: 'object'}, 5)
//» [ { some: 'object' },
// { some: 'object' },
// { some: 'object' },
// { some: 'object' },
// { some: 'object' } ]
repeat(5, 5)
//» [ 5, 5, 5, 5, 5 ]
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
| Commits | Contributor |
|---|---|
| 17 | jonschlinkert |
| 3 | LinusU |
| 1 | architectcodes |
Jon Schlinkert
Copyright © 2018, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on August 19, 2018.
Lodash provides a `repeat` function that creates a string by repeating the given string n times. It is different from repeat-element as it works on strings and not on array elements.
repeat-string is similar to lodash.repeat but is a standalone package that repeats strings. It does not create arrays of repeated elements like repeat-element.
fill-range generates an array of numbers or letters, optionally passing an increment or step to use, which can be used to create sequences. It is more complex and feature-rich compared to repeat-element, which only repeats a single value.
FAQs
Create an array by repeating the given value n times.
The npm package repeat-element receives a total of 11,155,650 weekly downloads. As such, repeat-element popularity was classified as popular.
We found that repeat-element demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.