mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
16 lines
339 B
JavaScript
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;
|
|
};
|
|
}
|