teeverc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/index.js +22 -0
- package/package.json +16 -0
package/README.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function assertInteger(value) {
|
|
4
|
+
if (!Number.isInteger(value)) {
|
|
5
|
+
throw new TypeError("Expected an integer");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isOdd(value) {
|
|
10
|
+
assertInteger(value);
|
|
11
|
+
return Math.abs(value % 2) === 1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isEven(value) {
|
|
15
|
+
assertInteger(value);
|
|
16
|
+
return value % 2 === 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = {
|
|
20
|
+
isOdd,
|
|
21
|
+
isEven
|
|
22
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "teeverc",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Small utility package exporting isOdd and isEven.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"keywords": [
|
|
11
|
+
"placeholder",
|
|
12
|
+
"reserve",
|
|
13
|
+
"npm"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT"
|
|
16
|
+
}
|