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
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
49 Stars
70 Commits
17 Forks
6 Watching
1 Branches
5 Contributors
Updated on 06 Feb 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-4.6%
4,093,956
Compared to previous day
Last week
5.2%
23,586,054
Compared to previous week
Last month
31.8%
87,973,922
Compared to previous month
Last year
-7.7%
853,388,156
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.
Please read the contributing guide for avice on opening issues, pull requests, and coding standards.
Commits | Contributor |
---|---|
61 | 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 November 03, 2016.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/27 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
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