Gathering detailed insights and metrics for repeat-string
Gathering detailed insights and metrics for repeat-string
Gathering detailed insights and metrics for repeat-string
Gathering detailed insights and metrics for repeat-string
Repeat the given string n times. Fastest implementation for repeating a string (2x faster than the native method)
npm install repeat-string
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
50 Stars
70 Commits
16 Forks
6 Watchers
1 Branches
5 Contributors
Updated on Jul 01, 2025
Latest Version
1.6.1
Package Id
repeat-string@1.6.1
Size
3.26 kB
NPM Version
3.10.3
Node Version
6.7.0
Published on
Oct 23, 2016
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Repeat the given string n times. Fastest implementation for repeating a string.
Install with npm:
1$ npm install --save repeat-string
Repeat the given string
the specified number
of times.
Example:
Example
1var repeat = require('repeat-string'); 2repeat('A', 5); 3//=> AAAAA
Params
string
{String}: The string to repeatnumber
{Number}: The number of times to repeat the stringreturns
{String}: Repeated stringRepeat string is significantly faster than the native method (which is itself faster than repeating):
1# 2x 2repeat-string █████████████████████████ (26,953,977 ops/sec) 3repeating █████████ (9,855,695 ops/sec) 4native ██████████████████ (19,453,895 ops/sec) 5 6# 3x 7repeat-string █████████████████████████ (19,445,252 ops/sec) 8repeating ███████████ (8,661,565 ops/sec) 9native ████████████████████ (16,020,598 ops/sec) 10 11# 10x 12repeat-string █████████████████████████ (23,792,521 ops/sec) 13repeating █████████ (8,571,332 ops/sec) 14native ███████████████ (14,582,955 ops/sec) 15 16# 50x 17repeat-string █████████████████████████ (23,640,179 ops/sec) 18repeating █████ (5,505,509 ops/sec) 19native ██████████ (10,085,557 ops/sec) 20 21# 250x 22repeat-string █████████████████████████ (23,489,618 ops/sec) 23repeating ████ (3,962,937 ops/sec) 24native ████████ (7,724,892 ops/sec) 25 26# 2000x 27repeat-string █████████████████████████ (20,315,172 ops/sec) 28repeating ████ (3,297,079 ops/sec) 29native ███████ (6,203,331 ops/sec) 30 31# 20000x 32repeat-string █████████████████████████ (23,382,915 ops/sec) 33repeating ███ (2,980,058 ops/sec) 34native █████ (5,578,808 ops/sec)
Run the benchmarks
Install dev dependencies:
1npm i -d && node benchmark
repeat-element: Create an array by repeating the given value n times. | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Commits | Contributor |
---|---|
51 | jonschlinkert |
2 | LinusU |
2 | tbusser |
1 | doowb |
1 | wooorm |
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
1$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
1$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on October 23, 2016.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More