UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.

14 lines (11 loc) 269 B
'use strict'; var floor = Math.floor; module.exports = function (x) { if (isNaN(x)) return NaN; x = Number(x); if (x === 0) return x; if (x === Infinity) return Infinity; if (x === -Infinity) return -Infinity; if (x > 0) return floor(x); return -floor(-x); };