string-repeat-x
v1.1.2
Published
Constructs and returns a new string which contains the specified number of copies of the string.
Downloads
25
Maintainers
Readme
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 | The count. |
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