source: node_modules/ramda-adjunct/es/repeatStr.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import { curry, invoker, flip } from 'ramda';
2import ponyfill from './internal/ponyfills/String.repeat';
3import isFunction from './isFunction';
4export var repeatStrPonyfill = curry(ponyfill);
5export var repeatStrInvoker = flip(invoker(1, 'repeat'));
6
7/**
8 * Constructs and returns a new string which contains the specified
9 * number of copies of the string on which it was called, concatenated together.
10 *
11 * @func repeatStr
12 * @memberOf RA
13 * @since {@link https://char0n.github.io/ramda-adjunct/2.11.0|v2.11.0}
14 * @category List
15 * @sig String -> Number -> String
16 * @param {string} value String value to be repeated
17 * @param {number} count An integer between 0 and +∞: [0, +∞), indicating the number of times to repeat the string in the newly-created string that is to be returned
18 * @return {string} A new string containing the specified number of copies of the given string
19 * @example
20 *
21 * RA.repeatStr('a', 3); //=> 'aaa'
22 */
23var repeatStr = isFunction(String.prototype.repeat) ? repeatStrInvoker : repeatStrPonyfill;
24export default repeatStr;
Note: See TracBrowser for help on using the repository browser.