@technobuddha/library
Version: 
A large library of useful functions
18 lines (17 loc) • 514 B
TypeScript
/**
 * Add leading zeros to a number to ensure a string of a minimum length
 * @param input - The number to pad
 * @param length - The minimum length of the resulting string
 * @returns number as a string with leading zeros as needed
 * @example
 * ```typescript
 * pad(5); // "05"
 * pad(42, 4); // "0042"
 * pad(-7, 3); // "-07"
 * pad(NaN, 4); // " NaN"
 * pad(Infinity, 6); // "Infinity"
 * ```
 * @group Math
 * @category Verbalization
 */
export declare function pad(input: number, length?: number): string;