source: node_modules/ramda-adjunct/es/padCharsEnd.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.3 KB
RevLine 
[d24f17c]1import { curry, invoker, flip } from 'ramda';
2import ponyfill from './internal/ponyfills/String.padEnd';
3import isFunction from './isFunction';
4export var padEndPonyfill = curry(ponyfill);
5export var padEndInvoker = flip(invoker(2, 'padEnd'));
6
7/**
8 * The function pads the current string with a given string
9 * (repeated, if needed) so that the resulting string reaches a given length.
10 * The padding is applied from the end of the current string.
11 *
12 * @func padCharsEnd
13 * @memberOf RA
14 * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
15 * @category String
16 * @sig String -> Number -> String -> String
17 * @param {string} padString The string to pad the current string with
18 * @param {number} targetLength The length of the resulting string once
19 * the current string has been padded
20 * @param {string} value String value to be padded
21 * @return {string} A new string of the specified length with the pad string
22 * applied at the end of the current string
23 * @see {@link RA.padEnd|padEnd}, {@link RA.padCharsStart|padCharsStart}, {@link RA.padStart|padStart}
24 * @example
25 *
26 * RA.padCharsEnd('-', 3, 'a'); // => 'a--'
27 * RA.padCharsEnd('foo', 10, 'abc'); // => 'abcfoofoof'
28 * RA.padCharsEnd('123456', 6, 'abc'); // => 'abc123'
29 */
30var padCharsEnd = isFunction(String.prototype.padEnd) ? padEndInvoker : padEndPonyfill;
31export default padCharsEnd;
Note: See TracBrowser for help on using the repository browser.