Untitled
4 years ago in Plain Text
var TEST = function () {
const range = [-2147483648, 2147483647];
return {
exec: function (num) {
const numStr = '' + num;
let invNumStr = '', i = numStr.length;
while (numStr[--i]) {
if (numStr[i] === '-') {
invNumStr = '-' + invNumStr;
break;
}
invNumStr += numStr[i];
}
const res = parseInt(invNumStr) || 0;
return (res < range[0] || range[1] < res) ? 0 : res;
}
};
}();