22 lines
426 B
JavaScript
22 lines
426 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = toInteger;
|
|
|
|
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);
|
|
}
|
|
|
|
module.exports = exports.default; |