What is repeating?
The 'repeating' npm package is a simple utility that allows you to create a new string by repeating a given string a specified number of times. It is useful for generating repeated patterns, filling spaces, or creating specific string-based designs programmatically.
What are repeating's main functionalities?
String repetition
This feature allows you to repeat a string a specified number of times. The first argument is the number of times to repeat, and the second argument is the string to repeat.
const repeating = require('repeating');
console.log(repeating(3, 'abc')); // 'abcabcabc'
Other packages similar to repeating
repeat-string
Similar to 'repeating', 'repeat-string' allows you to repeat a string multiple times. It offers a straightforward API similar to 'repeating' but differs slightly in implementation, which might affect performance in edge cases.
pad
While primarily used for padding strings, 'pad' can also repeat strings to achieve the desired length. This package provides more general string manipulation capabilities compared to the singular focus of 'repeating'.
repeating
Repeat a string - fast
Usage
$ npm install --save repeating
var repeating = require('repeating');
repeating('unicorn ', 100);
CLI
$ npm install --global repeating
$ repeating --help
Usage
repeating <string> <count>
Example
repeating 'unicorn ' 2
unicorn unicorn
License
MIT © Sindre Sorhus