source: node_modules/ramda-adjunct/lib/padCharsStart.js@ e48199a

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

Initial commit

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[d24f17c]1"use strict";
2
3exports.__esModule = true;
4exports.padStartPonyfill = exports.padStartInvoker = exports["default"] = void 0;
5var _ramda = require("ramda");
6var _isFunction = _interopRequireDefault(require("./isFunction"));
7var _String = _interopRequireDefault(require("./internal/ponyfills/String.padStart"));
8function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9var padStartInvoker = (0, _ramda.flip)((0, _ramda.invoker)(2, 'padStart'));
10exports.padStartInvoker = padStartInvoker;
11var 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 */
34exports.padStartPonyfill = padStartPonyfill;
35var padCharsStart = (0, _isFunction["default"])(String.prototype.padStart) ? padStartInvoker : padStartPonyfill;
36var _default = padCharsStart;
37exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.