Sha256: f61b75ca7910c00d5539bf360542962391111e3705f2cc81eda85ff6555abd3e
Contents?: true
Size: 352 Bytes
Versions: 19
Compression:
Stored size: 352 Bytes
Contents
export default function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return ( (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber ); }
Version data entries
19 entries across 19 versions & 1 rubygems