Files
cocos4/polyfill/misc.js
T
2017-05-16 14:31:41 +08:00

16 lines
339 B
JavaScript

if (!Math.sign) {
Math.sign = function (x) {
x = +x; // convert to a number
if (x === 0 || isNaN(x)) {
return x;
}
return x > 0 ? 1 : -1;
};
}
if (!Number.isInteger) {
Number.isInteger = function (value) {
return typeof value === 'number' && (value | 0) === value;
};
}