[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports.padStartPonyfill = exports.padStartInvoker = exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | var _isFunction = _interopRequireDefault(require("./isFunction"));
|
---|
| 7 | var _String = _interopRequireDefault(require("./internal/ponyfills/String.padStart"));
|
---|
| 8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
| 9 | var padStartInvoker = (0, _ramda.flip)((0, _ramda.invoker)(2, 'padStart'));
|
---|
| 10 | exports.padStartInvoker = padStartInvoker;
|
---|
| 11 | var padStartPonyfill = (0, _ramda.curry)(_String["default"]);
|
---|
| 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 start of the current string.
|
---|
| 17 | *
|
---|
| 18 | * @func padCharsStart
|
---|
| 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 the current string has been padded
|
---|
| 25 | * @param {string} value String value to be padded
|
---|
| 26 | * @return {string} A new string of the specified length with the pad string on the start of current string
|
---|
| 27 | * @see {@link RA.padStart|padStart}, {@link RA.padEnd|padEnd}, {@link RA.padCharsEnd|padCharsEnd}
|
---|
| 28 | * @example
|
---|
| 29 | *
|
---|
| 30 | * RA.padCharsStart('-', 3, 'a'); // => '--a'
|
---|
| 31 | * RA.padCharsStart('foo', 10, 'abc'); // => 'foofoofabc'
|
---|
| 32 | * RA.padCharsStart('123456', 6, 'abc'); // => '123abc'
|
---|
| 33 | */
|
---|
| 34 | exports.padStartPonyfill = padStartPonyfill;
|
---|
| 35 | var padCharsStart = (0, _isFunction["default"])(String.prototype.padStart) ? padStartInvoker : padStartPonyfill;
|
---|
| 36 | var _default = padCharsStart;
|
---|
| 37 | exports["default"] = _default; |
---|