Sha256: edbe0045c9bbf0421ae590ea7a640c35e7cb37895662daf2ccd671a8a6f4cece
Contents?: true
Size: 328 Bytes
Versions: 57
Compression:
Stored size: 328 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
57 entries across 56 versions & 11 rubygems