is-odd-ts 2.0.0 → 2.0.3
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/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +165 -95
- package/dist/index.test.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @param {number} num - The number to check if it's odd.
|
|
16
16
|
* @returns {boolean} - Returns `true` if the number is odd, `false` if it's even.
|
|
17
|
-
* @throws {TypeError} - Throws if the input is not a finite number.
|
|
18
|
-
* @throws {
|
|
17
|
+
* @throws {TypeError} - Throws if the input is not a finite number or integer.
|
|
18
|
+
* @throws {RangeError} - Throws if the input is not an integer or exceeds the safe integer limit.
|
|
19
19
|
*/
|
|
20
20
|
export declare const isOdd: (num: number) => boolean;
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @param {number} num - The number to check if it's odd.
|
|
16
16
|
* @returns {boolean} - Returns `true` if the number is odd, `false` if it's even.
|
|
17
|
-
* @throws {TypeError} - Throws if the input is not a finite number.
|
|
18
|
-
* @throws {
|
|
17
|
+
* @throws {TypeError} - Throws if the input is not a finite number or integer.
|
|
18
|
+
* @throws {RangeError} - Throws if the input is not an integer or exceeds the safe integer limit.
|
|
19
19
|
*/
|
|
20
20
|
export const isOdd = (num) => {
|
|
21
21
|
if (!Number.isFinite(num)) {
|
|
22
22
|
throw new TypeError("Expected a finite number");
|
|
23
23
|
}
|
|
24
24
|
if (!Number.isInteger(num)) {
|
|
25
|
-
throw new
|
|
25
|
+
throw new TypeError("Expected an integer");
|
|
26
26
|
}
|
|
27
27
|
if (!Number.isSafeInteger(num)) {
|
|
28
|
-
throw new
|
|
28
|
+
throw new RangeError("Value exceeds maximum safe integer");
|
|
29
29
|
}
|
|
30
30
|
return num % 2 !== 0;
|
|
31
31
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAW,EAAE;IAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAW,EAAE;IAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC,CAAC"}
|
package/dist/index.test.js
CHANGED
|
@@ -1,126 +1,196 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { test } from "node:test";
|
|
3
|
+
import fc from "fast-check";
|
|
3
4
|
import { isOdd } from "./index.js";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
assert.deepStrictEqual(isOdd(-3), true);
|
|
18
|
-
},
|
|
19
|
-
);
|
|
20
|
-
await t.test(
|
|
6
|
+
fc.configureGlobal({
|
|
7
|
+
numRuns: 100_000,
|
|
8
|
+
baseSize: "xlarge",
|
|
9
|
+
});
|
|
10
|
+
test("isOdd function with integers", { concurrency: true }, (t) => {
|
|
11
|
+
t.test("should return true when the input is an odd positive integer", () => {
|
|
12
|
+
assert.deepStrictEqual(isOdd(1), true);
|
|
13
|
+
});
|
|
14
|
+
t.test("should return true when the input is an odd negative integer", () => {
|
|
15
|
+
assert.deepStrictEqual(isOdd(-1), true);
|
|
16
|
+
});
|
|
17
|
+
t.test(
|
|
21
18
|
"should return false when the input is an even positive integer",
|
|
22
19
|
() => {
|
|
23
20
|
assert.deepStrictEqual(isOdd(2), false);
|
|
24
|
-
assert.deepStrictEqual(isOdd(4), false);
|
|
25
21
|
},
|
|
26
22
|
);
|
|
27
|
-
|
|
23
|
+
t.test(
|
|
28
24
|
"should return false when the input is an even negative integer",
|
|
29
25
|
() => {
|
|
30
26
|
assert.deepStrictEqual(isOdd(-2), false);
|
|
31
|
-
assert.deepStrictEqual(isOdd(-4), false);
|
|
32
27
|
},
|
|
33
28
|
);
|
|
34
|
-
|
|
29
|
+
t.test("should return false when the input is zero", () => {
|
|
35
30
|
assert.deepStrictEqual(isOdd(0), false);
|
|
36
31
|
});
|
|
37
|
-
|
|
32
|
+
t.test("should return false when the input is negative zero", () => {
|
|
38
33
|
assert.deepStrictEqual(isOdd(-0), false);
|
|
39
34
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
message: "Expected an integer",
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
);
|
|
48
|
-
await t.test(
|
|
49
|
-
"should throw an error when the input is a negative float",
|
|
50
|
-
() => {
|
|
51
|
-
assert.throws(() => isOdd(-1.5), {
|
|
52
|
-
message: "Expected an integer",
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
test("isOdd function with special constants and edge cases", async (t) => {
|
|
58
|
-
await t.test("should throw an error when the input is NaN", () => {
|
|
59
|
-
assert.throws(() => isOdd(Number.NaN), {
|
|
60
|
-
message: "Expected a finite number",
|
|
35
|
+
t.test("should throw an error when the input is a positive float", () => {
|
|
36
|
+
assert.throws(() => isOdd(1.5), {
|
|
37
|
+
name: "TypeError",
|
|
38
|
+
message: "Expected an integer",
|
|
61
39
|
});
|
|
62
40
|
});
|
|
63
|
-
|
|
64
|
-
assert.throws(() => isOdd(
|
|
65
|
-
|
|
41
|
+
t.test("should throw an error when the input is a negative float", () => {
|
|
42
|
+
assert.throws(() => isOdd(-1.5), {
|
|
43
|
+
name: "TypeError",
|
|
44
|
+
message: "Expected an integer",
|
|
66
45
|
});
|
|
67
46
|
});
|
|
68
|
-
|
|
69
|
-
assert.throws(() => isOdd(
|
|
47
|
+
t.test("should throw when input is not a number", () => {
|
|
48
|
+
assert.throws(() => isOdd("5"), {
|
|
49
|
+
name: "TypeError",
|
|
50
|
+
message: "Expected a finite number",
|
|
51
|
+
});
|
|
52
|
+
assert.throws(() => isOdd(null), {
|
|
53
|
+
name: "TypeError",
|
|
54
|
+
message: "Expected a finite number",
|
|
55
|
+
});
|
|
56
|
+
assert.throws(() => isOdd(undefined), {
|
|
57
|
+
name: "TypeError",
|
|
70
58
|
message: "Expected a finite number",
|
|
71
59
|
});
|
|
72
60
|
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
assert.deepStrictEqual(isOdd(Number.MAX_SAFE_INTEGER - 1), false);
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
await t.test(
|
|
86
|
-
"should return true when the input is Number.MIN_SAFE_INTEGER (negative)",
|
|
87
|
-
() => {
|
|
88
|
-
assert.deepStrictEqual(isOdd(Number.MIN_SAFE_INTEGER), true);
|
|
89
|
-
},
|
|
90
|
-
);
|
|
91
|
-
await t.test(
|
|
92
|
-
"should return false when the input is the smallest even integer below MIN_SAFE_INTEGER",
|
|
93
|
-
() => {
|
|
94
|
-
assert.deepStrictEqual(isOdd(Number.MIN_SAFE_INTEGER + 1), false);
|
|
95
|
-
},
|
|
96
|
-
);
|
|
97
|
-
await t.test(
|
|
98
|
-
"should throw an error when the input is exactly one more than Number.MAX_SAFE_INTEGER",
|
|
99
|
-
() => {
|
|
100
|
-
assert.throws(() => isOdd(Number.MAX_SAFE_INTEGER + 1), {
|
|
101
|
-
message: "Value exceeds maximum safe integer",
|
|
61
|
+
});
|
|
62
|
+
test(
|
|
63
|
+
"isOdd function with special constants and edge cases",
|
|
64
|
+
{ concurrency: true },
|
|
65
|
+
(t) => {
|
|
66
|
+
t.test("should throw an error when the input is NaN", () => {
|
|
67
|
+
assert.throws(() => isOdd(Number.NaN), {
|
|
68
|
+
name: "TypeError",
|
|
69
|
+
message: "Expected a finite number",
|
|
102
70
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
assert.throws(() => isOdd(Number.MIN_SAFE_INTEGER - 1), {
|
|
109
|
-
message: "Value exceeds maximum safe integer",
|
|
71
|
+
});
|
|
72
|
+
t.test("should throw an error when the input is Infinity", () => {
|
|
73
|
+
assert.throws(() => isOdd(Number.POSITIVE_INFINITY), {
|
|
74
|
+
name: "TypeError",
|
|
75
|
+
message: "Expected a finite number",
|
|
110
76
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
77
|
+
});
|
|
78
|
+
t.test("should throw an error when the input is -Infinity", () => {
|
|
79
|
+
assert.throws(() => isOdd(Number.NEGATIVE_INFINITY), {
|
|
80
|
+
name: "TypeError",
|
|
81
|
+
message: "Expected a finite number",
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
t.test(
|
|
85
|
+
"should return true when the input is Number.MAX_SAFE_INTEGER (positive)",
|
|
86
|
+
() => {
|
|
87
|
+
assert.deepStrictEqual(isOdd(Number.MAX_SAFE_INTEGER), true);
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
t.test(
|
|
91
|
+
"should return false when the input is the largest even safe integer (positive)",
|
|
92
|
+
() => {
|
|
93
|
+
assert.deepStrictEqual(isOdd(Number.MAX_SAFE_INTEGER - 1), false);
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
t.test(
|
|
97
|
+
"should return true when the input is Number.MIN_SAFE_INTEGER (negative)",
|
|
98
|
+
() => {
|
|
99
|
+
assert.deepStrictEqual(isOdd(Number.MIN_SAFE_INTEGER), true);
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
t.test(
|
|
103
|
+
"should return false when the input is the smallest even integer below MIN_SAFE_INTEGER",
|
|
104
|
+
() => {
|
|
105
|
+
assert.deepStrictEqual(isOdd(Number.MIN_SAFE_INTEGER + 1), false);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
t.test(
|
|
109
|
+
"should throw an error when the input is exactly one more than Number.MAX_SAFE_INTEGER",
|
|
110
|
+
() => {
|
|
111
|
+
assert.throws(() => isOdd(Number.MAX_SAFE_INTEGER + 1), {
|
|
112
|
+
name: "RangeError",
|
|
113
|
+
message: "Value exceeds maximum safe integer",
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
t.test(
|
|
118
|
+
"should throw an error when the input is exactly one less than Number.MIN_SAFE_INTEGER",
|
|
119
|
+
() => {
|
|
120
|
+
assert.throws(() => isOdd(Number.MIN_SAFE_INTEGER - 1), {
|
|
121
|
+
name: "RangeError",
|
|
122
|
+
message: "Value exceeds maximum safe integer",
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
t.test(
|
|
127
|
+
"should return false when the input is a large even negative integer",
|
|
128
|
+
() => {
|
|
129
|
+
assert.deepStrictEqual(isOdd(-9007199254740990), false);
|
|
130
|
+
},
|
|
131
|
+
);
|
|
132
|
+
t.test(
|
|
133
|
+
"should return true when the input is a large odd negative integer",
|
|
134
|
+
() => {
|
|
135
|
+
assert.deepStrictEqual(isOdd(-9007199254740991), true);
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
test(
|
|
141
|
+
"isOdd property: returns true for all safe odd integers",
|
|
142
|
+
{ concurrency: true },
|
|
143
|
+
() => {
|
|
144
|
+
fc.assert(
|
|
145
|
+
fc.property(
|
|
146
|
+
fc.maxSafeInteger().filter((n) => Math.abs(n % 2) === 1),
|
|
147
|
+
(n) => assert.deepStrictEqual(isOdd(n), true),
|
|
148
|
+
),
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
test(
|
|
153
|
+
"isOdd property: returns false for all safe even integers",
|
|
154
|
+
{ concurrency: true },
|
|
155
|
+
() => {
|
|
156
|
+
fc.assert(
|
|
157
|
+
fc.property(
|
|
158
|
+
fc.maxSafeInteger().filter((n) => n % 2 === 0),
|
|
159
|
+
(n) => assert.deepStrictEqual(isOdd(n), false),
|
|
160
|
+
),
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
test("isOdd property — floats throw", { concurrency: true }, () => {
|
|
165
|
+
fc.assert(
|
|
166
|
+
fc.property(
|
|
167
|
+
fc.float({
|
|
168
|
+
noNaN: true,
|
|
169
|
+
noDefaultInfinity: true,
|
|
170
|
+
noInteger: true,
|
|
171
|
+
}),
|
|
172
|
+
(n) =>
|
|
173
|
+
assert.throws(() => isOdd(n), {
|
|
174
|
+
name: "TypeError",
|
|
175
|
+
message: "Expected an integer",
|
|
176
|
+
}),
|
|
177
|
+
),
|
|
118
178
|
);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
179
|
+
});
|
|
180
|
+
test("isOdd property — doubles throw", { concurrency: true }, () => {
|
|
181
|
+
fc.assert(
|
|
182
|
+
fc.property(
|
|
183
|
+
fc.double({
|
|
184
|
+
noNaN: true,
|
|
185
|
+
noDefaultInfinity: true,
|
|
186
|
+
noInteger: true,
|
|
187
|
+
}),
|
|
188
|
+
(n) =>
|
|
189
|
+
assert.throws(() => isOdd(n), {
|
|
190
|
+
name: "TypeError",
|
|
191
|
+
message: "Expected an integer",
|
|
192
|
+
}),
|
|
193
|
+
),
|
|
124
194
|
);
|
|
125
195
|
});
|
|
126
196
|
//# sourceMappingURL=index.test.js.map
|
package/dist/index.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,EAAE,CAAC,eAAe,CAAC;IAClB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,IAAI,CAAC,8BAA8B,EA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|
|
1
1
|
{
|
|
2
2
|
"name": "is-odd-ts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A strict TypeScript-only utility to check if a number is odd, with modern type safety.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"lint": "biome check --write",
|
|
12
12
|
"lint:fix": "biome check --unsafe --write",
|
|
13
|
-
"test": "
|
|
13
|
+
"test": "node --experimental-strip-types --test src/**/*.test.ts"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
@@ -48,18 +48,20 @@
|
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"volta": {
|
|
51
|
-
"node": "22.17.
|
|
51
|
+
"node": "22.17.1"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@biomejs/biome": "^2.1.
|
|
57
|
+
"@biomejs/biome": "^2.1.2",
|
|
58
|
+
"@stryker-mutator/core": "^9.0.1",
|
|
58
59
|
"@tsconfig/node-ts": "^23.6.1",
|
|
59
60
|
"@tsconfig/node22": "^22.0.2",
|
|
60
61
|
"@tsconfig/recommended": "^1.0.10",
|
|
61
62
|
"@tsconfig/strictest": "^2.0.5",
|
|
62
|
-
"@types/node": "^22.16.
|
|
63
|
+
"@types/node": "^22.16.5",
|
|
64
|
+
"fast-check": "^4.2.0",
|
|
63
65
|
"typescript": "^5.8.3"
|
|
64
66
|
}
|
|
65
67
|
}
|