mathball
Version:
A JavaScript library for Competitive Programming
11 lines (9 loc) • 309 B
JavaScript
;
/*
* Non-negative Integer Validation
*/
module.exports = function (arg, func) {
if (typeof arg != "number" || arg < 0 || !Number.isInteger(arg)) {
throw new TypeError("Invalid argument received: " + JSON.stringify(arg) + "\n'" + func + "()' only accepts a non-negative integer!\n");
}
};