hd-utils
Version:
A handy utils for modern JS developers
18 lines (14 loc) • 409 B
TypeScript
/**
* @description function which takes a string of characters and adds a "padding" string of your choice to the start (or left) of the passed string.
* @example
*
padStart('foo', 5)
// => " foo"
padStart('foobar', 6)
// => "foobar"
padStart(1, 2, '0')
// => "01"
padStart(17, 5, 0)
// => "00017"
*/
export default function padStart(input: string, targetLength: number, padString?: string): string;