1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports.padEndPonyfill = exports.padEndInvoker = exports["default"] = void 0;
|
---|
5 | var _ramda = require("ramda");
|
---|
6 | var _String = _interopRequireDefault(require("./internal/ponyfills/String.padEnd"));
|
---|
7 | var _isFunction = _interopRequireDefault(require("./isFunction"));
|
---|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
9 | var padEndPonyfill = (0, _ramda.curry)(_String["default"]);
|
---|
10 | exports.padEndPonyfill = padEndPonyfill;
|
---|
11 | var padEndInvoker = (0, _ramda.flip)((0, _ramda.invoker)(2, 'padEnd'));
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * The function pads the current string with a given string
|
---|
15 | * (repeated, if needed) so that the resulting string reaches a given length.
|
---|
16 | * The padding is applied from the end of the current string.
|
---|
17 | *
|
---|
18 | * @func padCharsEnd
|
---|
19 | * @memberOf RA
|
---|
20 | * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
---|
21 | * @category String
|
---|
22 | * @sig String -> Number -> String -> String
|
---|
23 | * @param {string} padString The string to pad the current string with
|
---|
24 | * @param {number} targetLength The length of the resulting string once
|
---|
25 | * the current string has been padded
|
---|
26 | * @param {string} value String value to be padded
|
---|
27 | * @return {string} A new string of the specified length with the pad string
|
---|
28 | * applied at the end of the current string
|
---|
29 | * @see {@link RA.padEnd|padEnd}, {@link RA.padCharsStart|padCharsStart}, {@link RA.padStart|padStart}
|
---|
30 | * @example
|
---|
31 | *
|
---|
32 | * RA.padCharsEnd('-', 3, 'a'); // => 'a--'
|
---|
33 | * RA.padCharsEnd('foo', 10, 'abc'); // => 'abcfoofoof'
|
---|
34 | * RA.padCharsEnd('123456', 6, 'abc'); // => 'abc123'
|
---|
35 | */
|
---|
36 | exports.padEndInvoker = padEndInvoker;
|
---|
37 | var padCharsEnd = (0, _isFunction["default"])(String.prototype.padEnd) ? padEndInvoker : padEndPonyfill;
|
---|
38 | var _default = padCharsEnd;
|
---|
39 | exports["default"] = _default; |
---|