hugoWebsite/node_modules/date-fns/esm/_lib/toInteger/index.js

13 lines
296 B
JavaScript
Raw Normal View History

2022-10-29 00:20:35 +02:00
export default function toInteger(dirtyNumber) {
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
return NaN;
}
var number = Number(dirtyNumber);
if (isNaN(number)) {
return number;
}
return number < 0 ? Math.ceil(number) : Math.floor(number);
}