ts-data-forge 7.0.0 → 7.0.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/dist/array/impl/array-utils-creation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-creation.mjs +1 -1
- package/dist/array/impl/array-utils-creation.mjs.map +1 -1
- package/dist/array/impl/array-utils-iterators.mjs +1 -1
- package/dist/array/impl/array-utils-iterators.mjs.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts +1 -1
- package/dist/array/impl/array-utils-reducing-value.d.mts.map +1 -1
- package/dist/array/impl/array-utils-reducing-value.mjs +0 -1
- package/dist/array/impl/array-utils-reducing-value.mjs.map +1 -1
- package/dist/array/impl/array-utils-search.d.mts +0 -2
- 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/array/impl/array-utils-set-op.d.mts.map +1 -1
- package/dist/array/impl/array-utils-set-op.mjs +0 -1
- package/dist/array/impl/array-utils-set-op.mjs.map +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts +1 -1
- package/dist/array/impl/array-utils-transformation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-transformation.mjs +2 -4
- package/dist/array/impl/array-utils-transformation.mjs.map +1 -1
- package/dist/array/impl/array-utils-validation.d.mts.map +1 -1
- package/dist/array/impl/array-utils-validation.mjs +3 -9
- package/dist/array/impl/array-utils-validation.mjs.map +1 -1
- package/dist/collections/imap-mapped.d.mts +622 -3
- package/dist/collections/imap-mapped.d.mts.map +1 -1
- package/dist/collections/imap-mapped.mjs +111 -18
- package/dist/collections/imap-mapped.mjs.map +1 -1
- package/dist/collections/imap.d.mts +3 -3
- package/dist/collections/imap.d.mts.map +1 -1
- package/dist/collections/imap.mjs +6 -5
- package/dist/collections/imap.mjs.map +1 -1
- package/dist/collections/iset-mapped.d.mts +4 -4
- package/dist/collections/iset-mapped.d.mts.map +1 -1
- package/dist/collections/iset-mapped.mjs +8 -4
- package/dist/collections/iset-mapped.mjs.map +1 -1
- package/dist/collections/iset.d.mts +2 -2
- package/dist/collections/iset.d.mts.map +1 -1
- package/dist/collections/iset.mjs +5 -2
- package/dist/collections/iset.mjs.map +1 -1
- package/dist/collections/queue.mjs +20 -20
- package/dist/collections/queue.mjs.map +1 -1
- package/dist/collections/stack.mjs +17 -17
- package/dist/collections/stack.mjs.map +1 -1
- package/dist/functional/optional/impl/optional-flat-map.d.mts +2 -2
- package/dist/functional/pipe.d.mts.map +1 -1
- package/dist/functional/pipe.mjs.map +1 -1
- package/dist/functional/result/impl/result-flat-map.d.mts +2 -2
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts +5 -3
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.d.mts.map +1 -1
- package/dist/functional/ternary-result/impl/ternary-result-flat-map.mjs.map +1 -1
- package/dist/guard/has-key.d.mts.map +1 -1
- package/dist/guard/has-key.mjs +1 -3
- package/dist/guard/has-key.mjs.map +1 -1
- package/dist/guard/is-non-null-object.d.mts.map +1 -1
- package/dist/guard/is-non-null-object.mjs +1 -3
- package/dist/guard/is-non-null-object.mjs.map +1 -1
- package/dist/guard/key-is-in.d.mts.map +1 -1
- package/dist/guard/key-is-in.mjs +1 -3
- package/dist/guard/key-is-in.mjs.map +1 -1
- package/dist/json/json.mjs +5 -7
- package/dist/json/json.mjs.map +1 -1
- package/dist/number/branded-types/non-zero-safe-int.mjs +2 -2
- package/dist/number/branded-types/positive-safe-int.mjs +1 -1
- package/dist/number/branded-types/safe-int.mjs +2 -2
- package/dist/number/branded-types/safe-uint.mjs +1 -1
- package/dist/number/num-arithmetic-types.d.mts.map +1 -1
- package/dist/number/num.mjs +3 -3
- package/dist/object/object.mjs +1 -1
- package/dist/object/object.mjs.map +1 -1
- package/dist/others/fast-deep-equal.d.mts.map +1 -1
- package/dist/others/fast-deep-equal.mjs +0 -1
- package/dist/others/fast-deep-equal.mjs.map +1 -1
- package/dist/others/unknown-to-string.mjs +2 -2
- package/dist/others/unknown-to-string.mjs.map +1 -1
- package/package.json +5 -5
- package/src/array/impl/array-utils-creation.mts +1 -1
- package/src/array/impl/array-utils-iterators.mts +1 -1
- package/src/array/impl/array-utils-reducing-value.mts +1 -2
- package/src/array/impl/array-utils-search.mts +0 -2
- package/src/array/impl/array-utils-set-op.mts +0 -1
- package/src/array/impl/array-utils-transformation.mts +8 -6
- package/src/array/impl/array-utils-validation.mts +1 -5
- package/src/collections/imap-mapped.mts +696 -34
- package/src/collections/imap-mapped.test.mts +61 -13
- package/src/collections/imap.mts +20 -9
- package/src/collections/imap.test.mts +9 -8
- package/src/collections/iset-mapped.mts +18 -10
- package/src/collections/iset-mapped.test.mts +6 -1
- package/src/collections/iset.mts +11 -4
- package/src/collections/iset.test.mts +6 -8
- package/src/collections/queue.mts +32 -32
- package/src/collections/stack.mts +26 -26
- package/src/functional/optional/impl/optional-flat-map.mts +2 -2
- package/src/functional/optional.test.mts +6 -4
- package/src/functional/pipe.mts +0 -1
- package/src/functional/pipe.test.mts +2 -1
- package/src/functional/result/impl/result-flat-map.mts +2 -2
- package/src/functional/result.test.mts +3 -2
- package/src/functional/ternary-result/impl/ternary-result-flat-map.mts +5 -3
- package/src/functional/ternary-result.test.mts +8 -3
- package/src/guard/has-key.mts +1 -3
- package/src/guard/is-non-null-object.mts +0 -1
- package/src/guard/key-is-in.mts +1 -3
- package/src/json/json.mts +5 -8
- package/src/json/json.test.mts +2 -2
- package/src/number/branded-types/non-zero-safe-int.mts +2 -2
- package/src/number/branded-types/positive-safe-int.mts +1 -1
- package/src/number/branded-types/safe-int.mts +2 -2
- package/src/number/branded-types/safe-uint.mts +1 -1
- package/src/number/num-arithmetic-types.mts +0 -4
- package/src/number/num.mts +3 -3
- package/src/number/num.test.mts +2 -2
- package/src/object/object.mts +2 -2
- package/src/others/fast-deep-equal.mts +0 -2
- package/src/others/map-nullable.test.mts +4 -3
- package/src/others/unknown-to-string.mts +2 -2
|
@@ -265,7 +265,7 @@ export function count<E>(
|
|
|
265
265
|
* ```ts
|
|
266
266
|
* const words = ['Ada', 'Grace', 'Alan', 'Barbara'] as const;
|
|
267
267
|
*
|
|
268
|
-
* const counts = Arr.countBy(words, (word) => word
|
|
268
|
+
* const counts = Arr.countBy(words, (word) => word.at(0));
|
|
269
269
|
*
|
|
270
270
|
* assert.deepStrictEqual(counts.get('A'), Optional.some(2));
|
|
271
271
|
*
|
|
@@ -503,7 +503,6 @@ export function sum(array: readonly Int[]): Int;
|
|
|
503
503
|
export function sum(array: readonly number[]): number;
|
|
504
504
|
|
|
505
505
|
export function sum(array: readonly number[]): number {
|
|
506
|
-
// eslint-disable-next-line ts-data-forge/prefer-arr-sum
|
|
507
506
|
return array.reduce((prev, curr) => prev + curr, 0);
|
|
508
507
|
}
|
|
509
508
|
|
|
@@ -196,7 +196,6 @@ export function findLast<E>(
|
|
|
196
196
|
*
|
|
197
197
|
* const indexOfB = Arr.findIndex(letters, (letter) => letter === 'b');
|
|
198
198
|
*
|
|
199
|
-
* // eslint-disable-next-line unicorn/prefer-array-index-of
|
|
200
199
|
* const indexOfMissing = Arr.findIndex<string>((letter) => letter === 'z')(
|
|
201
200
|
* letters,
|
|
202
201
|
* );
|
|
@@ -263,7 +262,6 @@ export function findIndex<E>(
|
|
|
263
262
|
*
|
|
264
263
|
* const lastIndexOfB = Arr.findLastIndex(letters, (letter) => letter === 'b');
|
|
265
264
|
*
|
|
266
|
-
* // eslint-disable-next-line unicorn/prefer-array-index-of
|
|
267
265
|
* const notFound = Arr.findLastIndex<string>((letter) => letter === 'z')(
|
|
268
266
|
* letters,
|
|
269
267
|
* );
|
|
@@ -105,7 +105,6 @@ export const setIntersection = <
|
|
|
105
105
|
array1: readonly E1[],
|
|
106
106
|
array2: readonly E2[],
|
|
107
107
|
): readonly (E1 & E2)[] =>
|
|
108
|
-
// transformer-ignore-next-line
|
|
109
108
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
110
109
|
(array1 as readonly (E1 & E2)[]).filter((e) => array2.includes(e));
|
|
111
110
|
|
|
@@ -540,13 +540,15 @@ export function flat<E, D extends SafeUintWithSmallInt = 1>(
|
|
|
540
540
|
const depth = arrayOrDepth as SafeUintWithSmallInt | undefined;
|
|
541
541
|
|
|
542
542
|
return (array) => flat(array, depth);
|
|
543
|
-
}
|
|
544
|
-
return (array) => flat(array, 1);
|
|
545
|
-
} else {
|
|
546
|
-
expectType<typeof arrayOrDepth, readonly E[]>('=');
|
|
543
|
+
}
|
|
547
544
|
|
|
548
|
-
|
|
545
|
+
if (arrayOrDepth === undefined) {
|
|
546
|
+
return (array) => flat(array, 1);
|
|
549
547
|
}
|
|
548
|
+
|
|
549
|
+
expectType<typeof arrayOrDepth, readonly E[]>('=');
|
|
550
|
+
|
|
551
|
+
return arrayOrDepth.flat();
|
|
550
552
|
}
|
|
551
553
|
|
|
552
554
|
case 0:
|
|
@@ -709,7 +711,7 @@ export const concat = <
|
|
|
709
711
|
*
|
|
710
712
|
* const groupedByLength = Arr.groupBy(animals, (animal) => animal.length);
|
|
711
713
|
*
|
|
712
|
-
* const groupedByFirstLetter = Arr.groupBy((animal: string) => animal
|
|
714
|
+
* const groupedByFirstLetter = Arr.groupBy((animal: string) => animal.at(0))(
|
|
713
715
|
* animals,
|
|
714
716
|
* );
|
|
715
717
|
*
|
|
@@ -28,7 +28,6 @@ import { type ArrayIndex, type SizeType } from '../../types.mjs';
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
export const isArray = <E,>(value: E): value is FilterArray<E> =>
|
|
31
|
-
// eslint-disable-next-line ts-data-forge/prefer-arr-is-array
|
|
32
31
|
Array.isArray(value);
|
|
33
32
|
|
|
34
33
|
type FilterArray<T> = T extends T
|
|
@@ -64,7 +63,6 @@ type Cast<A, B> = A extends B ? A : never;
|
|
|
64
63
|
* ```
|
|
65
64
|
*/
|
|
66
65
|
export const isEmpty = <E,>(array: readonly E[]): array is readonly [] =>
|
|
67
|
-
// eslint-disable-next-line ts-data-forge/prefer-arr-is-array-of-length
|
|
68
66
|
array.length === 0;
|
|
69
67
|
|
|
70
68
|
/**
|
|
@@ -88,9 +86,7 @@ export const isEmpty = <E,>(array: readonly E[]): array is readonly [] =>
|
|
|
88
86
|
*/
|
|
89
87
|
export const isNonEmpty = <E,>(
|
|
90
88
|
array: readonly E[],
|
|
91
|
-
): array is NonEmptyArray<E> =>
|
|
92
|
-
// eslint-disable-next-line ts-data-forge/prefer-arr-is-non-empty
|
|
93
|
-
array.length > 0;
|
|
89
|
+
): array is NonEmptyArray<E> => array.length > 0;
|
|
94
90
|
|
|
95
91
|
/**
|
|
96
92
|
* Checks if an array has a specific length.
|