Sha256: a24b81700ce6db6cd1b7b75d5ecd8492f31ee66c69c389daf3092b7785442f85
Contents?: true
Size: 460 Bytes
Versions: 69
Compression:
Stored size: 460 Bytes
Contents
/** * "Convert" value into an 32-bit integer. * Works like `Math.floor` if val > 0 and `Math.ceil` if val < 0. * IMPORTANT: val will wrap at 2^31 and -2^31. * Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7 */ function toInt(val){ // we do not use lang/toNumber because of perf and also because it // doesn't break the functionality return ~~val; } module.exports = toInt;
Version data entries
69 entries across 69 versions & 2 rubygems