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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WidenLiteral } from 'ts-type-forge';
|
|
1
2
|
import { Optional } from '../functional/index.mjs';
|
|
2
3
|
import { type MapSetKeyType, type SizeType } from '../types.mjs';
|
|
3
4
|
/**
|
|
@@ -29,28 +30,122 @@ import { type MapSetKeyType, type SizeType } from '../types.mjs';
|
|
|
29
30
|
* @template KM The type of the mapped primitive keys (string, number, etc.).
|
|
30
31
|
*/
|
|
31
32
|
type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
32
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The number of elements in the map.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
40
|
+
*
|
|
41
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
42
|
+
*
|
|
43
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
44
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
45
|
+
*
|
|
46
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
47
|
+
* [
|
|
48
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
49
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
50
|
+
* ],
|
|
51
|
+
* toKey,
|
|
52
|
+
* fromKey,
|
|
53
|
+
* );
|
|
54
|
+
*
|
|
55
|
+
* assert.isTrue(map.size === 2);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
33
58
|
size: SizeType.Arr;
|
|
34
59
|
/**
|
|
35
60
|
* Checks if a key exists in the map.
|
|
36
61
|
*
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
66
|
+
*
|
|
67
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
68
|
+
*
|
|
69
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
70
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
71
|
+
*
|
|
72
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
73
|
+
* [[{ x: 1, y: 2 }, 'A']],
|
|
74
|
+
* toKey,
|
|
75
|
+
* fromKey,
|
|
76
|
+
* );
|
|
77
|
+
*
|
|
78
|
+
* assert.isTrue(map.has({ x: 1, y: 2 }));
|
|
79
|
+
*
|
|
80
|
+
* assert.isFalse(map.has({ x: 3, y: 4 }));
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
37
83
|
* @param key The key to check.
|
|
38
84
|
* @returns `true` if the key exists, `false` otherwise.
|
|
39
85
|
*/
|
|
40
|
-
has: (key: K) => boolean;
|
|
86
|
+
has: (key: K | (WidenLiteral<K> & {})) => boolean;
|
|
41
87
|
/**
|
|
42
88
|
* Retrieves the value associated with a key.
|
|
43
89
|
*
|
|
90
|
+
* @example
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
94
|
+
*
|
|
95
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
96
|
+
*
|
|
97
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
98
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
99
|
+
*
|
|
100
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
101
|
+
* [[{ x: 1, y: 2 }, 'A']],
|
|
102
|
+
* toKey,
|
|
103
|
+
* fromKey,
|
|
104
|
+
* );
|
|
105
|
+
*
|
|
106
|
+
* assert.deepStrictEqual(map.get({ x: 1, y: 2 }), Optional.some('A'));
|
|
107
|
+
*
|
|
108
|
+
* assert.deepStrictEqual(map.get({ x: 0, y: 0 }), Optional.none);
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
44
111
|
* @param key The key to retrieve.
|
|
45
112
|
* @returns The value associated with the key wrapped with `Optional.some`, or
|
|
46
113
|
* `Optional.none` if the key does not exist.
|
|
47
114
|
*/
|
|
48
|
-
get: (key: K) => Optional<V>;
|
|
115
|
+
get: (key: K | (WidenLiteral<K> & {})) => Optional<V>;
|
|
49
116
|
/**
|
|
50
117
|
* Checks if all elements in the map satisfy a predicate. Also supports a
|
|
51
118
|
* type predicate overload that narrows the type of values in the map if the
|
|
52
119
|
* predicate returns true for all elements.
|
|
53
120
|
*
|
|
121
|
+
* @example
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
125
|
+
*
|
|
126
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
127
|
+
*
|
|
128
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
129
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
130
|
+
*
|
|
131
|
+
* const map = IMapMapped.create<Point, number, string>(
|
|
132
|
+
* [
|
|
133
|
+
* [{ x: 0, y: 0 }, 2],
|
|
134
|
+
* [{ x: 1, y: 0 }, 4],
|
|
135
|
+
* ],
|
|
136
|
+
* toKey,
|
|
137
|
+
* fromKey,
|
|
138
|
+
* );
|
|
139
|
+
*
|
|
140
|
+
* const allEven = map.every((value) => value % 2 === 0);
|
|
141
|
+
*
|
|
142
|
+
* const isNarrowed = map.every((value): value is 2 | 4 => value % 2 === 0);
|
|
143
|
+
*
|
|
144
|
+
* assert.isTrue(allEven);
|
|
145
|
+
*
|
|
146
|
+
* assert.isTrue(isNarrowed);
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
54
149
|
* @template W The narrowed type of the values.
|
|
55
150
|
* @param predicate A function to test each key-value pair.
|
|
56
151
|
* @returns `true` if all elements satisfy the predicate, `false` otherwise.
|
|
@@ -59,6 +154,30 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
59
154
|
/**
|
|
60
155
|
* Checks if at least one element in the map satisfies a predicate.
|
|
61
156
|
*
|
|
157
|
+
* @example
|
|
158
|
+
*
|
|
159
|
+
* ```ts
|
|
160
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
161
|
+
*
|
|
162
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
163
|
+
*
|
|
164
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
165
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
166
|
+
*
|
|
167
|
+
* const map = IMapMapped.create<Point, number, string>(
|
|
168
|
+
* [
|
|
169
|
+
* [{ x: 0, y: 0 }, 3],
|
|
170
|
+
* [{ x: 1, y: 0 }, 7],
|
|
171
|
+
* ],
|
|
172
|
+
* toKey,
|
|
173
|
+
* fromKey,
|
|
174
|
+
* );
|
|
175
|
+
*
|
|
176
|
+
* assert.isTrue(map.some((value) => value > 5));
|
|
177
|
+
*
|
|
178
|
+
* assert.isFalse(map.some((value) => value > 10));
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
62
181
|
* @param predicate A function to test each key-value pair.
|
|
63
182
|
* @returns `true` if at least one element satisfies the predicate, `false`
|
|
64
183
|
* otherwise.
|
|
@@ -67,6 +186,39 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
67
186
|
/**
|
|
68
187
|
* Deletes a key-value pair from the map.
|
|
69
188
|
*
|
|
189
|
+
* @example
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
193
|
+
*
|
|
194
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
195
|
+
*
|
|
196
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
197
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
198
|
+
*
|
|
199
|
+
* const original = IMapMapped.create<Point, string, string>(
|
|
200
|
+
* [
|
|
201
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
202
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
203
|
+
* ],
|
|
204
|
+
* toKey,
|
|
205
|
+
* fromKey,
|
|
206
|
+
* );
|
|
207
|
+
*
|
|
208
|
+
* const withoutRight = original.delete({ x: 1, y: 0 });
|
|
209
|
+
*
|
|
210
|
+
* assert.deepStrictEqual(
|
|
211
|
+
* original.get({ x: 1, y: 0 }),
|
|
212
|
+
* Optional.some('right'),
|
|
213
|
+
* );
|
|
214
|
+
*
|
|
215
|
+
* assert.deepStrictEqual(withoutRight.get({ x: 1, y: 0 }), Optional.none);
|
|
216
|
+
*
|
|
217
|
+
* assert.isTrue(original.size === 2);
|
|
218
|
+
*
|
|
219
|
+
* assert.isTrue(withoutRight.size === 1);
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
70
222
|
* @param key The key to delete.
|
|
71
223
|
* @returns A new IMapMapped instance without the specified key.
|
|
72
224
|
*/
|
|
@@ -74,6 +226,36 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
74
226
|
/**
|
|
75
227
|
* Sets a key-value pair in the map.
|
|
76
228
|
*
|
|
229
|
+
* @example
|
|
230
|
+
*
|
|
231
|
+
* ```ts
|
|
232
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
233
|
+
*
|
|
234
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
235
|
+
*
|
|
236
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
237
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
238
|
+
*
|
|
239
|
+
* const base = IMapMapped.create<Point, string, string>(
|
|
240
|
+
* [[{ x: 0, y: 0 }, 'origin']],
|
|
241
|
+
* toKey,
|
|
242
|
+
* fromKey,
|
|
243
|
+
* );
|
|
244
|
+
*
|
|
245
|
+
* const updated = base.set({ x: 0, y: 0 }, 'home');
|
|
246
|
+
*
|
|
247
|
+
* const extended = base.set({ x: 1, y: 0 }, 'right');
|
|
248
|
+
*
|
|
249
|
+
* assert.deepStrictEqual(base.get({ x: 0, y: 0 }), Optional.some('origin'));
|
|
250
|
+
*
|
|
251
|
+
* assert.deepStrictEqual(updated.get({ x: 0, y: 0 }), Optional.some('home'));
|
|
252
|
+
*
|
|
253
|
+
* assert.deepStrictEqual(
|
|
254
|
+
* extended.get({ x: 1, y: 0 }),
|
|
255
|
+
* Optional.some('right'),
|
|
256
|
+
* );
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
77
259
|
* @param key The key to set.
|
|
78
260
|
* @param value The value to associate with the key.
|
|
79
261
|
* @returns A new IMapMapped instance with the specified key-value pair.
|
|
@@ -82,6 +264,36 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
82
264
|
/**
|
|
83
265
|
* Updates the value associated with a key using an updater function.
|
|
84
266
|
*
|
|
267
|
+
* @example
|
|
268
|
+
*
|
|
269
|
+
* ```ts
|
|
270
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
271
|
+
*
|
|
272
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
273
|
+
*
|
|
274
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
275
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
276
|
+
*
|
|
277
|
+
* const scores = IMapMapped.create<Point, number, string>(
|
|
278
|
+
* [
|
|
279
|
+
* [{ x: 0, y: 0 }, 10],
|
|
280
|
+
* [{ x: 1, y: 0 }, 8],
|
|
281
|
+
* ],
|
|
282
|
+
* toKey,
|
|
283
|
+
* fromKey,
|
|
284
|
+
* );
|
|
285
|
+
*
|
|
286
|
+
* const boosted = scores.update({ x: 0, y: 0 }, (value) => value + 5);
|
|
287
|
+
*
|
|
288
|
+
* const unchanged = scores.update({ x: 9, y: 9 }, (value) => value + 1);
|
|
289
|
+
*
|
|
290
|
+
* assert.deepStrictEqual(boosted.get({ x: 0, y: 0 }), Optional.some(15));
|
|
291
|
+
*
|
|
292
|
+
* assert.deepStrictEqual(scores.get({ x: 0, y: 0 }), Optional.some(10));
|
|
293
|
+
*
|
|
294
|
+
* assert.isTrue(unchanged === scores);
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
85
297
|
* @param key The key whose value to update.
|
|
86
298
|
* @param updater A function that takes the current value and returns the new
|
|
87
299
|
* value.
|
|
@@ -91,6 +303,40 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
91
303
|
/**
|
|
92
304
|
* Applies a series of mutations to the map.
|
|
93
305
|
*
|
|
306
|
+
* @example
|
|
307
|
+
*
|
|
308
|
+
* ```ts
|
|
309
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
310
|
+
*
|
|
311
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
312
|
+
*
|
|
313
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
314
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
315
|
+
*
|
|
316
|
+
* const base = IMapMapped.create<Point, string, string>(
|
|
317
|
+
* [
|
|
318
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
319
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
320
|
+
* ],
|
|
321
|
+
* toKey,
|
|
322
|
+
* fromKey,
|
|
323
|
+
* );
|
|
324
|
+
*
|
|
325
|
+
* const mutated = base.withMutations([
|
|
326
|
+
* { type: 'set', key: { x: 2, y: 0 }, value: 'far' },
|
|
327
|
+
* { type: 'update', key: { x: 1, y: 0 }, updater: (v) => v.toUpperCase() },
|
|
328
|
+
* { type: 'delete', key: { x: 0, y: 0 } },
|
|
329
|
+
* ]);
|
|
330
|
+
*
|
|
331
|
+
* assert.deepStrictEqual(mutated.get({ x: 2, y: 0 }), Optional.some('far'));
|
|
332
|
+
*
|
|
333
|
+
* assert.deepStrictEqual(mutated.get({ x: 1, y: 0 }), Optional.some('RIGHT'));
|
|
334
|
+
*
|
|
335
|
+
* assert.deepStrictEqual(mutated.get({ x: 0, y: 0 }), Optional.none);
|
|
336
|
+
*
|
|
337
|
+
* assert.deepStrictEqual(base.get({ x: 1, y: 0 }), Optional.some('right'));
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
94
340
|
* @param actions An array of mutation actions (delete, set, or update).
|
|
95
341
|
* @returns A new IMapMapped instance with all mutations applied.
|
|
96
342
|
*/
|
|
@@ -109,6 +355,33 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
109
355
|
/**
|
|
110
356
|
* Maps the values of the map to new values.
|
|
111
357
|
*
|
|
358
|
+
* @example
|
|
359
|
+
*
|
|
360
|
+
* ```ts
|
|
361
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
362
|
+
*
|
|
363
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
364
|
+
*
|
|
365
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
366
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
367
|
+
*
|
|
368
|
+
* const map = IMapMapped.create<Point, number, string>(
|
|
369
|
+
* [
|
|
370
|
+
* [{ x: 0, y: 0 }, 1],
|
|
371
|
+
* [{ x: 1, y: 0 }, 2],
|
|
372
|
+
* ],
|
|
373
|
+
* toKey,
|
|
374
|
+
* fromKey,
|
|
375
|
+
* );
|
|
376
|
+
*
|
|
377
|
+
* const doubled = map.map((value) => value * 2);
|
|
378
|
+
*
|
|
379
|
+
* assert.deepStrictEqual(Array.from(doubled), [
|
|
380
|
+
* [{ x: 0, y: 0 }, 2],
|
|
381
|
+
* [{ x: 1, y: 0 }, 4],
|
|
382
|
+
* ]);
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
112
385
|
* @template V2 The type of the new values.
|
|
113
386
|
* @param mapFn A function that maps a value and key to a new value.
|
|
114
387
|
* @returns A new IMapMapped instance with mapped values.
|
|
@@ -118,6 +391,33 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
118
391
|
* Maps the keys of the map to new keys. Note: The key type cannot be changed
|
|
119
392
|
* because `toKey` and `fromKey` would become unusable.
|
|
120
393
|
*
|
|
394
|
+
* @example
|
|
395
|
+
*
|
|
396
|
+
* ```ts
|
|
397
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
398
|
+
*
|
|
399
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
400
|
+
*
|
|
401
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
402
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
403
|
+
*
|
|
404
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
405
|
+
* [
|
|
406
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
407
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
408
|
+
* ],
|
|
409
|
+
* toKey,
|
|
410
|
+
* fromKey,
|
|
411
|
+
* );
|
|
412
|
+
*
|
|
413
|
+
* const shifted = map.mapKeys((p) => ({ x: p.x + 10, y: p.y + 10 }));
|
|
414
|
+
*
|
|
415
|
+
* assert.deepStrictEqual(Array.from(shifted), [
|
|
416
|
+
* [{ x: 10, y: 10 }, 'origin'],
|
|
417
|
+
* [{ x: 11, y: 10 }, 'right'],
|
|
418
|
+
* ]);
|
|
419
|
+
* ```
|
|
420
|
+
*
|
|
121
421
|
* @param mapFn A function that maps a key to a new key of the same type.
|
|
122
422
|
* @returns A new IMapMapped instance with mapped keys.
|
|
123
423
|
*/
|
|
@@ -125,6 +425,33 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
125
425
|
/**
|
|
126
426
|
* Maps the entries (key-value pairs) of the map to new entries.
|
|
127
427
|
*
|
|
428
|
+
* @example
|
|
429
|
+
*
|
|
430
|
+
* ```ts
|
|
431
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
432
|
+
*
|
|
433
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
434
|
+
*
|
|
435
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
436
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
437
|
+
*
|
|
438
|
+
* const map = IMapMapped.create<Point, number, string>(
|
|
439
|
+
* [
|
|
440
|
+
* [{ x: 0, y: 0 }, 1],
|
|
441
|
+
* [{ x: 1, y: 0 }, 2],
|
|
442
|
+
* ],
|
|
443
|
+
* toKey,
|
|
444
|
+
* fromKey,
|
|
445
|
+
* );
|
|
446
|
+
*
|
|
447
|
+
* const labeled = map.mapEntries(([key, value]) => [key, `value=${value}`]);
|
|
448
|
+
*
|
|
449
|
+
* assert.deepStrictEqual(Array.from(labeled), [
|
|
450
|
+
* [{ x: 0, y: 0 }, 'value=1'],
|
|
451
|
+
* [{ x: 1, y: 0 }, 'value=2'],
|
|
452
|
+
* ]);
|
|
453
|
+
* ```
|
|
454
|
+
*
|
|
128
455
|
* @template V2 The type of the new values in the entries.
|
|
129
456
|
* @param mapFn A function that maps an entry to a new entry (key must remain
|
|
130
457
|
* the same type).
|
|
@@ -134,42 +461,223 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
134
461
|
/**
|
|
135
462
|
* Executes a callback function for each key-value pair in the map.
|
|
136
463
|
*
|
|
464
|
+
* @example
|
|
465
|
+
*
|
|
466
|
+
* ```ts
|
|
467
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
468
|
+
*
|
|
469
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
470
|
+
*
|
|
471
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
472
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
473
|
+
*
|
|
474
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
475
|
+
* [
|
|
476
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
477
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
478
|
+
* ],
|
|
479
|
+
* toKey,
|
|
480
|
+
* fromKey,
|
|
481
|
+
* );
|
|
482
|
+
*
|
|
483
|
+
* const mut_entries: (readonly [Point, string])[] = [];
|
|
484
|
+
*
|
|
485
|
+
* map.forEach((value, key) => {
|
|
486
|
+
* mut_entries.push([key, value]);
|
|
487
|
+
* });
|
|
488
|
+
*
|
|
489
|
+
* assert.deepStrictEqual(mut_entries, [
|
|
490
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
491
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
492
|
+
* ]);
|
|
493
|
+
* ```
|
|
494
|
+
*
|
|
137
495
|
* @param callbackfn A function to execute for each element.
|
|
138
496
|
*/
|
|
139
497
|
forEach: (callbackfn: (value: V, key: K) => void) => void;
|
|
140
498
|
/**
|
|
141
499
|
* Returns an iterator for the keys in the map.
|
|
142
500
|
*
|
|
501
|
+
* @example
|
|
502
|
+
*
|
|
503
|
+
* ```ts
|
|
504
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
505
|
+
*
|
|
506
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
507
|
+
*
|
|
508
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
509
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
510
|
+
*
|
|
511
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
512
|
+
* [
|
|
513
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
514
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
515
|
+
* ],
|
|
516
|
+
* toKey,
|
|
517
|
+
* fromKey,
|
|
518
|
+
* );
|
|
519
|
+
*
|
|
520
|
+
* const keys = Array.from(map.keys());
|
|
521
|
+
*
|
|
522
|
+
* assert.deepStrictEqual(keys, [
|
|
523
|
+
* { x: 0, y: 0 },
|
|
524
|
+
* { x: 1, y: 0 },
|
|
525
|
+
* ]);
|
|
526
|
+
* ```
|
|
527
|
+
*
|
|
143
528
|
* @returns An iterable iterator of keys.
|
|
144
529
|
*/
|
|
145
530
|
keys: () => IterableIterator<K>;
|
|
146
531
|
/**
|
|
147
532
|
* Returns an iterator for the values in the map.
|
|
148
533
|
*
|
|
534
|
+
* @example
|
|
535
|
+
*
|
|
536
|
+
* ```ts
|
|
537
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
538
|
+
*
|
|
539
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
540
|
+
*
|
|
541
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
542
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
543
|
+
*
|
|
544
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
545
|
+
* [
|
|
546
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
547
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
548
|
+
* ],
|
|
549
|
+
* toKey,
|
|
550
|
+
* fromKey,
|
|
551
|
+
* );
|
|
552
|
+
*
|
|
553
|
+
* const values = Array.from(map.values());
|
|
554
|
+
*
|
|
555
|
+
* assert.deepStrictEqual(values, ['origin', 'right']);
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
149
558
|
* @returns An iterable iterator of values.
|
|
150
559
|
*/
|
|
151
560
|
values: () => IterableIterator<V>;
|
|
152
561
|
/**
|
|
153
562
|
* Returns an iterator for the entries (key-value pairs) in the map.
|
|
154
563
|
*
|
|
564
|
+
* @example
|
|
565
|
+
*
|
|
566
|
+
* ```ts
|
|
567
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
568
|
+
*
|
|
569
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
570
|
+
*
|
|
571
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
572
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
573
|
+
*
|
|
574
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
575
|
+
* [
|
|
576
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
577
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
578
|
+
* ],
|
|
579
|
+
* toKey,
|
|
580
|
+
* fromKey,
|
|
581
|
+
* );
|
|
582
|
+
*
|
|
583
|
+
* const entries = Array.from(map.entries());
|
|
584
|
+
*
|
|
585
|
+
* assert.deepStrictEqual(entries, [
|
|
586
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
587
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
588
|
+
* ]);
|
|
589
|
+
* ```
|
|
590
|
+
*
|
|
155
591
|
* @returns An iterable iterator of entries.
|
|
156
592
|
*/
|
|
157
593
|
entries: () => IterableIterator<readonly [K, V]>;
|
|
158
594
|
/**
|
|
159
595
|
* Converts the keys of the map to an array.
|
|
160
596
|
*
|
|
597
|
+
* @example
|
|
598
|
+
*
|
|
599
|
+
* ```ts
|
|
600
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
601
|
+
*
|
|
602
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
603
|
+
*
|
|
604
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
605
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
606
|
+
*
|
|
607
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
608
|
+
* [
|
|
609
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
610
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
611
|
+
* ],
|
|
612
|
+
* toKey,
|
|
613
|
+
* fromKey,
|
|
614
|
+
* );
|
|
615
|
+
*
|
|
616
|
+
* assert.deepStrictEqual(map.toKeysArray(), [
|
|
617
|
+
* { x: 0, y: 0 },
|
|
618
|
+
* { x: 1, y: 0 },
|
|
619
|
+
* ]);
|
|
620
|
+
* ```
|
|
621
|
+
*
|
|
161
622
|
* @returns A readonly array of keys.
|
|
162
623
|
*/
|
|
163
624
|
toKeysArray: () => readonly K[];
|
|
164
625
|
/**
|
|
165
626
|
* Converts the values of the map to an array.
|
|
166
627
|
*
|
|
628
|
+
* @example
|
|
629
|
+
*
|
|
630
|
+
* ```ts
|
|
631
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
632
|
+
*
|
|
633
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
634
|
+
*
|
|
635
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
636
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
637
|
+
*
|
|
638
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
639
|
+
* [
|
|
640
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
641
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
642
|
+
* ],
|
|
643
|
+
* toKey,
|
|
644
|
+
* fromKey,
|
|
645
|
+
* );
|
|
646
|
+
*
|
|
647
|
+
* assert.deepStrictEqual(map.toValuesArray(), ['origin', 'right']);
|
|
648
|
+
* ```
|
|
649
|
+
*
|
|
167
650
|
* @returns A readonly array of values.
|
|
168
651
|
*/
|
|
169
652
|
toValuesArray: () => readonly V[];
|
|
170
653
|
/**
|
|
171
654
|
* Converts the entries (key-value pairs) of the map to an array.
|
|
172
655
|
*
|
|
656
|
+
* @example
|
|
657
|
+
*
|
|
658
|
+
* ```ts
|
|
659
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
660
|
+
*
|
|
661
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
662
|
+
*
|
|
663
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
664
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
665
|
+
*
|
|
666
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
667
|
+
* [
|
|
668
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
669
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
670
|
+
* ],
|
|
671
|
+
* toKey,
|
|
672
|
+
* fromKey,
|
|
673
|
+
* );
|
|
674
|
+
*
|
|
675
|
+
* assert.deepStrictEqual(map.toEntriesArray(), [
|
|
676
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
677
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
678
|
+
* ]);
|
|
679
|
+
* ```
|
|
680
|
+
*
|
|
173
681
|
* @returns A readonly array of entries.
|
|
174
682
|
*/
|
|
175
683
|
toEntriesArray: () => readonly (readonly [K, V])[];
|
|
@@ -177,12 +685,60 @@ type IMapMappedInterface<K, V, KM extends MapSetKeyType> = Readonly<{
|
|
|
177
685
|
* Converts the map to an array of entries (key-value pairs). Alias for
|
|
178
686
|
* `toEntriesArray`.
|
|
179
687
|
*
|
|
688
|
+
* @example
|
|
689
|
+
*
|
|
690
|
+
* ```ts
|
|
691
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
692
|
+
*
|
|
693
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
694
|
+
*
|
|
695
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
696
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
697
|
+
*
|
|
698
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
699
|
+
* [
|
|
700
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
701
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
702
|
+
* ],
|
|
703
|
+
* toKey,
|
|
704
|
+
* fromKey,
|
|
705
|
+
* );
|
|
706
|
+
*
|
|
707
|
+
* assert.deepStrictEqual(map.toArray(), [
|
|
708
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
709
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
710
|
+
* ]);
|
|
711
|
+
* ```
|
|
712
|
+
*
|
|
180
713
|
* @returns A readonly array of entries.
|
|
181
714
|
*/
|
|
182
715
|
toArray: () => readonly (readonly [K, V])[];
|
|
183
716
|
/**
|
|
184
717
|
* Returns the underlying readonly JavaScript Map.
|
|
185
718
|
*
|
|
719
|
+
* @example
|
|
720
|
+
*
|
|
721
|
+
* ```ts
|
|
722
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
723
|
+
*
|
|
724
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
725
|
+
*
|
|
726
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
727
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
728
|
+
*
|
|
729
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
730
|
+
* [[{ x: 1, y: 2 }, 'A']],
|
|
731
|
+
* toKey,
|
|
732
|
+
* fromKey,
|
|
733
|
+
* );
|
|
734
|
+
*
|
|
735
|
+
* const raw = map.toRawMap();
|
|
736
|
+
*
|
|
737
|
+
* assert.isTrue(isMap(raw));
|
|
738
|
+
*
|
|
739
|
+
* assert.isTrue(raw.get(toKey({ x: 1, y: 2 })) === 'A');
|
|
740
|
+
* ```
|
|
741
|
+
*
|
|
186
742
|
* @returns The raw ReadonlyMap instance.
|
|
187
743
|
*/
|
|
188
744
|
toRawMap: () => ReadonlyMap<KM, V>;
|
|
@@ -234,6 +790,30 @@ export declare namespace IMapMapped {
|
|
|
234
790
|
* @template K The type of the custom keys.
|
|
235
791
|
* @template V The type of the values.
|
|
236
792
|
* @template KM The type of the mapped primitive keys.
|
|
793
|
+
* @example
|
|
794
|
+
*
|
|
795
|
+
* ```ts
|
|
796
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
797
|
+
*
|
|
798
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
799
|
+
*
|
|
800
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
801
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
802
|
+
*
|
|
803
|
+
* const map = IMapMapped.create<Point, string, string>(
|
|
804
|
+
* [
|
|
805
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
806
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
807
|
+
* ],
|
|
808
|
+
* toKey,
|
|
809
|
+
* fromKey,
|
|
810
|
+
* );
|
|
811
|
+
*
|
|
812
|
+
* assert.isTrue(map.size === 2);
|
|
813
|
+
*
|
|
814
|
+
* assert.deepStrictEqual(map.get({ x: 0, y: 0 }), Optional.some('origin'));
|
|
815
|
+
* ```
|
|
816
|
+
*
|
|
237
817
|
* @param iterable An iterable of key-value pairs using the custom key type.
|
|
238
818
|
* @param toKey A function that converts a custom key `K` to a primitive key
|
|
239
819
|
* `KM`. This function must be deterministic and produce unique values for
|
|
@@ -258,6 +838,45 @@ export declare namespace IMapMapped {
|
|
|
258
838
|
* @template K The type of the custom keys.
|
|
259
839
|
* @template V The type of the values.
|
|
260
840
|
* @template KM The type of the mapped primitive keys.
|
|
841
|
+
* @example
|
|
842
|
+
*
|
|
843
|
+
* ```ts
|
|
844
|
+
* type Point = Readonly<{ x: number; y: number }>;
|
|
845
|
+
*
|
|
846
|
+
* const toKey = (p: Point) => JSON.stringify(p);
|
|
847
|
+
*
|
|
848
|
+
* // eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
849
|
+
* const fromKey = (key: string) => JSON.parse(key) as Point;
|
|
850
|
+
*
|
|
851
|
+
* const first = IMapMapped.create<Point, string, string>(
|
|
852
|
+
* [
|
|
853
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
854
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
855
|
+
* ],
|
|
856
|
+
* toKey,
|
|
857
|
+
* fromKey,
|
|
858
|
+
* );
|
|
859
|
+
*
|
|
860
|
+
* const second = IMapMapped.create<Point, string, string>(
|
|
861
|
+
* [
|
|
862
|
+
* [{ x: 1, y: 0 }, 'right'],
|
|
863
|
+
* [{ x: 0, y: 0 }, 'origin'],
|
|
864
|
+
* ],
|
|
865
|
+
* toKey,
|
|
866
|
+
* fromKey,
|
|
867
|
+
* );
|
|
868
|
+
*
|
|
869
|
+
* const third = IMapMapped.create<Point, string, string>(
|
|
870
|
+
* [[{ x: 0, y: 0 }, 'different']],
|
|
871
|
+
* toKey,
|
|
872
|
+
* fromKey,
|
|
873
|
+
* );
|
|
874
|
+
*
|
|
875
|
+
* assert.isTrue(IMapMapped.equal(first, second));
|
|
876
|
+
*
|
|
877
|
+
* assert.isFalse(IMapMapped.equal(first, third));
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
261
880
|
* @param a The first IMapMapped instance to compare.
|
|
262
881
|
* @param b The second IMapMapped instance to compare.
|
|
263
882
|
* @returns `true` if the maps contain exactly the same key-value pairs,
|