num-parity-core 1.1.0 โ 1.1.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 +87 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# โก num-parity-core
|
|
2
|
+
|
|
3
|
+
> A minimal, fast and reliable Node.js utility to detect number parity (even or odd).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ Why num-parity-core?
|
|
8
|
+
|
|
9
|
+
Because number validation should be instant, predictable, and dependency-free.
|
|
10
|
+
|
|
11
|
+
No frameworks. No noise. Just logic.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ๐ฆ Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install num-parity-core
|
|
19
|
+
|
|
20
|
+
๐ง **Usage**
|
|
21
|
+
const { isEven, parity } = require("num-parity-core");
|
|
22
|
+
|
|
23
|
+
// Boolean check
|
|
24
|
+
console.log(isEven(10)); // true
|
|
25
|
+
console.log(isEven(7)); // false
|
|
26
|
+
|
|
27
|
+
// Human-readable result
|
|
28
|
+
console.log(parity(10)); // "even"
|
|
29
|
+
console.log(parity(7)); // "odd"
|
|
30
|
+
|
|
31
|
+
โ๏ธ **API Reference**
|
|
32
|
+
isEven(number)
|
|
33
|
+
|
|
34
|
+
Returns true if the number is even, otherwise false.
|
|
35
|
+
|
|
36
|
+
isEven(4); // true
|
|
37
|
+
isEven(9); // false
|
|
38
|
+
parity(number)
|
|
39
|
+
|
|
40
|
+
Returns a string representing the number parity:
|
|
41
|
+
|
|
42
|
+
"even"
|
|
43
|
+
"odd"
|
|
44
|
+
parity(2); // "even"
|
|
45
|
+
parity(3); // "odd"
|
|
46
|
+
|
|
47
|
+
๐งช **Example**
|
|
48
|
+
for (let i = 1; i <= 10; i++) {
|
|
49
|
+
console.log(i, "โ", parity(i));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Output:
|
|
53
|
+
|
|
54
|
+
1 โ odd
|
|
55
|
+
2 โ even
|
|
56
|
+
3 โ odd
|
|
57
|
+
4 โ even
|
|
58
|
+
5 โ odd
|
|
59
|
+
6 โ even
|
|
60
|
+
7 โ odd
|
|
61
|
+
8 โ even
|
|
62
|
+
9 โ odd
|
|
63
|
+
10 โ even
|
|
64
|
+
|
|
65
|
+
โก **Features**
|
|
66
|
+
|
|
67
|
+
โก Ultra lightweight
|
|
68
|
+
๐ง Zero dependencies
|
|
69
|
+
๐ Fast execution
|
|
70
|
+
๐ฆ Works in Node.js
|
|
71
|
+
๐งฉ Simple and predictable API
|
|
72
|
+
|
|
73
|
+
๐ **Roadmap**
|
|
74
|
+
TypeScript support
|
|
75
|
+
ESM module support
|
|
76
|
+
CLI tool (npx num-parity-core)
|
|
77
|
+
Browser compatibility
|
|
78
|
+
Benchmark optimizations
|
|
79
|
+
๐ค Contributing
|
|
80
|
+
|
|
81
|
+
Pull requests are welcome.
|
|
82
|
+
|
|
83
|
+
Keep it simple. Keep it clean.
|
|
84
|
+
|
|
85
|
+
๐ License
|
|
86
|
+
|
|
87
|
+
MIT โ use freely, build freely, improve freely.
|