num-parity-core 1.0.0
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/Debugs/tst.js +5 -0
- package/index.js +20 -0
- package/package.json +15 -0
- package/start.js +1 -0
package/Debugs/tst.js
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function isEven(number) {
|
|
2
|
+
if (typeof number !== "number") {
|
|
3
|
+
throw new Error("O valor precisa ser um número");
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return number % 2 === 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function parity(number) {
|
|
10
|
+
if (typeof number !== "number") {
|
|
11
|
+
throw new Error("O valor precisa ser um número");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return number % 2 === 0 ? "even" : "odd";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
isEven,
|
|
19
|
+
parity
|
|
20
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "num-parity-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Simple package to check if a number is even or odd",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"even",
|
|
8
|
+
"odd",
|
|
9
|
+
"parity",
|
|
10
|
+
"number",
|
|
11
|
+
"checker"
|
|
12
|
+
],
|
|
13
|
+
"author": "seu-nome",
|
|
14
|
+
"license": "MIT"
|
|
15
|
+
}
|
package/start.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./Debugs/tst.js')
|