Licence
MIT
Version
1.1.2
Deps
6
Size
239 kB
Vulns
0
Weekly
0
string-repeat-x
Constructs and returns a new string which contains the specified number of copies of the string.
module.exports ⇒ *
Kind: Exported member
Returns: * - The target.
| Param | Type | Description |
|---|---|---|
| string | string |
The string. |
| count | number |
string |
Example
import repeat from 'string-repeat-x';
repeat('abc', -1); // RangeError
repeat('abc', 0); // ''
repeat('abc', 1); // 'abc'
repeat('abc', 2); // 'abcabc'
repeat('abc', 3.5); // 'abcabcabc' (count will be converted to integer)
repeat('abc', 1/0); // RangeError