UNPKG
mathball
Version:
latest (0.4.0)
0.4.0
0.3.1
0.3.0
0.2.0
0.1.2
0.1.1
0.1.0
A JavaScript library for Competitive Programming
github.com/pbiswas101/Mathball
pbiswas101/Mathball
mathball
/
lib
/
validation
/
integer.js
9 lines
(7 loc)
•
308 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
'use strict'
;
/* * Integer Validation */
module
.
exports
=
function
(
arg, func
) {
if
(
typeof
arg !=
'number'
|| arg +
1
== arg || arg != arg || !
Number
.
isInteger
(arg))
throw
new
TypeError
(
'Invalid argument received: '
+
JSON
.
stringify
(arg) +
'\n\''
+ func +
'()\' only accept a positive integer!\n'
); };