CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
padEnd.js40 linesDownload Raw Back to lodash-es
1import createPadding from './_createPadding.js';2import stringSize from './_stringSize.js';3import toInteger from './toInteger.js';4import toString from './toString.js';5 6/**7 * Pads `string` on the right side if it's shorter than `length`. Padding8 * characters are truncated if they exceed `length`.9 *10 * @static11 * @memberOf _12 * @since 4.0.013 * @category String14 * @param {string} [string=''] The string to pad.15 * @param {number} [length=0] The padding length.16 * @param {string} [chars=' '] The string used as padding.17 * @returns {string} Returns the padded string.18 * @example19 *20 * _.padEnd('abc', 6);21 * // => 'abc   '22 *23 * _.padEnd('abc', 6, '_-');24 * // => 'abc_-_'25 *26 * _.padEnd('abc', 3);27 * // => 'abc'28 */29function padEnd(string, length, chars) {30  string = toString(string);31  length = toInteger(length);32 33  var strLength = length ? stringSize(string) : 0;34  return (length && strLength < length)35    ? (string + createPadding(length - strLength, chars))36    : string;37}38 39export default padEnd;40 
basant307/AI_Governance_Project · CoolFace