UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

40 lines (34 loc) 1.14 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _ramda = require("ramda"); var _padRightUntil = _interopRequireDefault(require("./padRightUntil")); var _lteThanLength = _interopRequireDefault(require("./lteThanLength")); /** * Length of the output string, `padString` and initial value. * `padString` is repeatedly appended to the `init` until the length of the string is equal to `lengthString`. * * @param {number} lengthString Length of the output string. * @param {string} padString * @param {string} init Intitial value * @see padLeft, padRightUntil, padRightUntil * * @return String * * @func * @category String * * @example * * R_.padRight(10, '0')('1') // '10000000000' * R_.padRight(-9, '0')('1') // '1' * R_.padRight(1, '0')('1') // '1' * * @sig Number -> a -> a */ var padRight = (0, _ramda.useWith)(_padRightUntil.default, [_lteThanLength.default, _ramda.identity, _ramda.identity]); var _default = padRight; exports.default = _default;