UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

28 lines (27 loc) 844 B
import { useWith, identity } from 'ramda'; import padRightUntil from './padRightUntil'; import lteThanLength from './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 = /*#__PURE__*/useWith(padRightUntil, [lteThanLength, identity, identity]); export default padRight;