num-parity-core 1.1.5 โ 1.1.7
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 +15 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,14 +13,13 @@ No frameworks. No noise. Just logic.
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
## ๐ฆ Installation
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
```bash
|
|
17
|
+
npm install num-parity-core
|
|
18
|
+
```
|
|
20
19
|
---
|
|
21
20
|
|
|
22
21
|
## ๐ง Usage
|
|
23
|
-
|
|
22
|
+
```js
|
|
24
23
|
const { isEven, parity } = require("num-parity-core");
|
|
25
24
|
|
|
26
25
|
// Boolean check
|
|
@@ -30,35 +29,37 @@ console.log(isEven(7)); // false
|
|
|
30
29
|
// Human-readable result
|
|
31
30
|
console.log(parity(10)); // "even"
|
|
32
31
|
console.log(parity(7)); // "odd"
|
|
33
|
-
|
|
32
|
+
```
|
|
34
33
|
---
|
|
35
34
|
|
|
36
35
|
## โ๏ธ API Reference
|
|
37
|
-
|
|
36
|
+
```js
|
|
38
37
|
isEven(number)
|
|
39
|
-
|
|
38
|
+
```
|
|
40
39
|
Returns true if the number is even, otherwise false.
|
|
41
|
-
|
|
40
|
+
```js
|
|
42
41
|
isEven(4); // true
|
|
43
42
|
isEven(9); // false
|
|
44
43
|
parity(number)
|
|
45
|
-
|
|
44
|
+
```
|
|
46
45
|
Returns a string representing the number parity:
|
|
47
46
|
|
|
48
47
|
"even"
|
|
49
48
|
"odd"
|
|
49
|
+
```js
|
|
50
50
|
parity(2); // "even"
|
|
51
51
|
parity(3); // "odd"
|
|
52
|
-
|
|
52
|
+
```
|
|
53
53
|
---
|
|
54
54
|
|
|
55
55
|
## ๐งช Example
|
|
56
|
+
```js
|
|
56
57
|
for (let i = 1; i <= 10; i++) {
|
|
57
58
|
console.log(i, "โ", parity(i));
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
```
|
|
60
61
|
Output:
|
|
61
|
-
|
|
62
|
+
```bash
|
|
62
63
|
1 โ odd
|
|
63
64
|
2 โ even
|
|
64
65
|
3 โ odd
|
|
@@ -69,7 +70,7 @@ Output:
|
|
|
69
70
|
8 โ even
|
|
70
71
|
9 โ odd
|
|
71
72
|
10 โ even
|
|
72
|
-
|
|
73
|
+
```
|
|
73
74
|
---
|
|
74
75
|
|
|
75
76
|
## โก Features
|