@williamthorsen/toolbelt.arrays 5.0.0 → 6.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/CHANGELOG.md +20 -0
- package/README.md +5 -11
- package/dist/esm/3-candidate/nullishCompare.js +1 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 6.0.0 — 2026-08-21
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- 🚨 **Breaking:** Correct the nullish guards' narrowing and rename `isNullable` (#206)
|
|
10
|
+
|
|
11
|
+
Fixes an issue where `isNullable` in `@williamthorsen/toolbelt.guards` narrowed both of its branches backwards: A value it confirmed to be null or undefined was typed as non-nullish, so dereferencing it inside the check compiled and then threw. It is now named `isNullish`, after the type it narrows to.
|
|
12
|
+
|
|
13
|
+
Separately, `isNonNullable` and `assertIsNonNullable` let an explicit type argument exclude `null` from the false branch while `null` still reached it at runtime. Both now take the value at its own type.
|
|
14
|
+
|
|
15
|
+
Migration: `isNullable` no longer exists, and `isNullish` narrows in the opposite direction, so a call site written against the old behavior now fails to compile. On `isNonNullable` and `assertIsNonNullable`, an explicit type argument narrower than the value's own type is now a compile error; inference-driven narrowing is unchanged, as is `filter(isNonNullable)`.
|
|
16
|
+
|
|
17
|
+
## 5.0.1 — 2026-08-16
|
|
18
|
+
|
|
19
|
+
### Tests
|
|
20
|
+
|
|
21
|
+
- Drop expect-type in favor of expectTypeOf (#175)
|
|
22
|
+
|
|
23
|
+
Replaces all imports of `expectTypeOf` from `expect-type` with the same import from `vitest`. Previously there had been imports from both libraries. `expect-type` is removed as a dependency.
|
|
24
|
+
|
|
5
25
|
## 5.0.0 — 2026-08-15
|
|
6
26
|
|
|
7
27
|
### Features
|
package/README.md
CHANGED
|
@@ -3,23 +3,17 @@
|
|
|
3
3
|
Array utilities.
|
|
4
4
|
|
|
5
5
|
<!-- section:release-notes -->
|
|
6
|
-
## Release notes —
|
|
6
|
+
## Release notes — v6.0.0 (2026-08-21)
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
|
-
- 🚨 **Breaking:**
|
|
10
|
+
- 🚨 **Breaking:** Correct the nullish guards' narrowing and rename `isNullable` (#206)
|
|
11
11
|
|
|
12
|
-
Fixes an issue where `
|
|
12
|
+
Fixes an issue where `isNullable` in `@williamthorsen/toolbelt.guards` narrowed both of its branches backwards: A value it confirmed to be null or undefined was typed as non-nullish, so dereferencing it inside the check compiled and then threw. It is now named `isNullish`, after the type it narrows to.
|
|
13
13
|
|
|
14
|
-
Separately, `
|
|
14
|
+
Separately, `isNonNullable` and `assertIsNonNullable` let an explicit type argument exclude `null` from the false branch while `null` still reached it at runtime. Both now take the value at its own type.
|
|
15
15
|
|
|
16
|
-
Migration:
|
|
17
|
-
|
|
18
|
-
- 🚨 **Breaking:** Rename `findOrThrow` to `findItemOrThrow` and document it (#153)
|
|
19
|
-
|
|
20
|
-
Renames `findOrThrow` to `findItemOrThrow` in `@williamthorsen/toolbelt.arrays` for consistency with repo naming conventions.
|
|
21
|
-
|
|
22
|
-
Migration: Consumers import `findItemOrThrow` from `@williamthorsen/toolbelt.arrays/candidate`. The signature and behavior are unchanged.
|
|
16
|
+
Migration: `isNullable` no longer exists, and `isNullish` narrows in the opposite direction, so a call site written against the old behavior now fails to compile. On `isNonNullable` and `assertIsNonNullable`, an explicit type argument narrower than the value's own type is now a compile error; inference-driven narrowing is unchanged, as is `filter(isNonNullable)`.
|
|
23
17
|
<!-- /section:release-notes -->
|
|
24
18
|
|
|
25
19
|
## Installation
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isNullish } from '@williamthorsen/toolbelt.guards';
|
|
1
2
|
export function makeNullishCompare(compare, options = {}) {
|
|
2
3
|
return function compareWithNullishHandling(a, b) {
|
|
3
4
|
return nullishCompare(compare, a, b, options);
|
|
@@ -15,6 +16,3 @@ export function nullishCompare(compare, a, b, options = {}) {
|
|
|
15
16
|
}
|
|
16
17
|
return compare(a, b) || 0;
|
|
17
18
|
}
|
|
18
|
-
function isNullish(value) {
|
|
19
|
-
return value === null || value === undefined;
|
|
20
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williamthorsen/toolbelt.arrays",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Array utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"CHANGELOG.md"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@williamthorsen/toolbelt.
|
|
48
|
-
"@williamthorsen/toolbelt.
|
|
47
|
+
"@williamthorsen/toolbelt.guards": "4.0.0",
|
|
48
|
+
"@williamthorsen/toolbelt.numbers": "7.0.0"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=24.0.0"
|