1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.repeatStrPonyfill = exports.repeatStrInvoker = exports["default"] = void 0;
|
---|
5 | var _ramda = require("ramda");
|
---|
6 | var _String = _interopRequireDefault(require("./internal/ponyfills/String.repeat"));
|
---|
7 | var _isFunction = _interopRequireDefault(require("./isFunction"));
|
---|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
9 | var repeatStrPonyfill = (0, _ramda.curry)(_String["default"]);
|
---|
10 | exports.repeatStrPonyfill = repeatStrPonyfill;
|
---|
11 | var repeatStrInvoker = (0, _ramda.flip)((0, _ramda.invoker)(1, 'repeat'));
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Constructs and returns a new string which contains the specified
|
---|
15 | * number of copies of the string on which it was called, concatenated together.
|
---|
16 | *
|
---|
17 | * @func repeatStr
|
---|
18 | * @memberOf RA
|
---|
19 | * @since {@link https://char0n.github.io/ramda-adjunct/2.11.0|v2.11.0}
|
---|
20 | * @category List
|
---|
21 | * @sig String -> Number -> String
|
---|
22 | * @param {string} value String value to be repeated
|
---|
23 | * @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
|
---|
24 | * @return {string} A new string containing the specified number of copies of the given string
|
---|
25 | * @example
|
---|
26 | *
|
---|
27 | * RA.repeatStr('a', 3); //=> 'aaa'
|
---|
28 | */
|
---|
29 | exports.repeatStrInvoker = repeatStrInvoker;
|
---|
30 | var repeatStr = (0, _isFunction["default"])(String.prototype.repeat) ? repeatStrInvoker : repeatStrPonyfill;
|
---|
31 | var _default = repeatStr;
|
---|
32 | exports["default"] = _default; |
---|