ts-data-forge 14.3.0 → 14.5.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/README.md +6 -0
- package/dist/array/impl/array-utils-search.d.mts.map +1 -1
- package/dist/array/impl/array-utils-search.mjs.map +1 -1
- package/dist/functional/optional/impl/index.d.mts +1 -0
- package/dist/functional/optional/impl/index.d.mts.map +1 -1
- package/dist/functional/optional/impl/index.mjs +1 -0
- package/dist/functional/optional/impl/index.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-match.d.mts +48 -0
- package/dist/functional/optional/impl/optional-match.d.mts.map +1 -0
- package/dist/functional/optional/impl/optional-match.mjs +22 -0
- package/dist/functional/optional/impl/optional-match.mjs.map +1 -0
- package/dist/functional/result/impl/index.d.mts +4 -0
- package/dist/functional/result/impl/index.d.mts.map +1 -1
- package/dist/functional/result/impl/index.mjs +4 -0
- package/dist/functional/result/impl/index.mjs.map +1 -1
- package/dist/functional/result/impl/result-from-optional.d.mts +41 -0
- package/dist/functional/result/impl/result-from-optional.d.mts.map +1 -0
- package/dist/functional/result/impl/result-from-optional.mjs +24 -0
- package/dist/functional/result/impl/result-from-optional.mjs.map +1 -0
- package/dist/functional/result/impl/result-match.d.mts +47 -0
- package/dist/functional/result/impl/result-match.d.mts.map +1 -0
- package/dist/functional/result/impl/result-match.mjs +24 -0
- package/dist/functional/result/impl/result-match.mjs.map +1 -0
- package/dist/functional/result/impl/result-safe-try.d.mts +51 -0
- package/dist/functional/result/impl/result-safe-try.d.mts.map +1 -0
- package/dist/functional/result/impl/result-safe-try.mjs +24 -0
- package/dist/functional/result/impl/result-safe-try.mjs.map +1 -0
- package/dist/functional/result/impl/result-safe-unwrap.d.mts +36 -0
- package/dist/functional/result/impl/result-safe-unwrap.d.mts.map +1 -0
- package/dist/functional/result/impl/result-safe-unwrap.mjs +14 -0
- package/dist/functional/result/impl/result-safe-unwrap.mjs.map +1 -0
- package/dist/object/object.d.mts +113 -0
- package/dist/object/object.d.mts.map +1 -1
- package/dist/object/object.mjs +29 -0
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/debounce-function.d.mts.map +1 -1
- package/dist/others/debounce-function.mjs.map +1 -1
- package/dist/others/fast-deep-equal.d.mts.map +1 -1
- package/dist/others/fast-deep-equal.mjs +1 -1
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/package.json +9 -9
- package/src/array/impl/array-utils-modification.test.mts +3 -3
- package/src/array/impl/array-utils-search.mts +22 -8
- package/src/array/impl/array-utils-shape-invariants.test.mts +3 -3
- package/src/array/impl/array-utils-transformation.test.mts +1 -1
- package/src/functional/optional/impl/index.mts +1 -0
- package/src/functional/optional/impl/optional-match.mts +108 -0
- package/src/functional/optional.test.mts +79 -0
- package/src/functional/result/impl/index.mts +4 -0
- package/src/functional/result/impl/result-from-optional.mts +80 -0
- package/src/functional/result/impl/result-match.mts +108 -0
- package/src/functional/result/impl/result-safe-try.mts +110 -0
- package/src/functional/result/impl/result-safe-unwrap.mts +50 -0
- package/src/functional/result.test.mts +331 -0
- package/src/guard/is-error.test.mts +7 -7
- package/src/object/object.mts +187 -0
- package/src/object/object.test.mts +120 -1
- package/src/others/debounce-function.mts +5 -1
- package/src/others/fast-deep-equal.mts +9 -2
|
@@ -11,7 +11,11 @@ export const debounce = <Args extends readonly unknown[]>(
|
|
|
11
11
|
func: (...args: Args) => void,
|
|
12
12
|
waitMilliseconds: number,
|
|
13
13
|
): ((...args: Args) => void) => {
|
|
14
|
-
|
|
14
|
+
// Not `ReturnType<typeof setTimeout>`: with both the DOM and Node
|
|
15
|
+
// declarations in scope that resolves to `unknown`, which `clearTimeout`
|
|
16
|
+
// will not take. Naming what `clearTimeout` accepts says the same thing and
|
|
17
|
+
// stays true in either environment.
|
|
18
|
+
let mut_timeoutId: Parameters<typeof clearTimeout>[0];
|
|
15
19
|
|
|
16
20
|
return (...args: Args): void => {
|
|
17
21
|
clearTimeout(mut_timeoutId);
|
|
@@ -94,6 +94,13 @@ export const fastDeepEqual = <T,>(a: T, b: T): boolean => {
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// true if both NaN, false otherwise
|
|
98
|
-
|
|
97
|
+
// true if both NaN, false otherwise. `Number.isNaN` takes a number: called
|
|
98
|
+
// with anything else it is always false, so the check belongs behind a
|
|
99
|
+
// `typeof` guard rather than relying on that.
|
|
100
|
+
return (
|
|
101
|
+
typeof a === 'number' &&
|
|
102
|
+
typeof b === 'number' &&
|
|
103
|
+
Number.isNaN(a) &&
|
|
104
|
+
Number.isNaN(b)
|
|
105
|
+
);
|
|
99
106
|
};
|