@mmstack/primitives 22.8.3 → 22.8.4
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/package.json
CHANGED
|
@@ -1357,7 +1357,9 @@ type DuplicateKeyPolicy = {
|
|
|
1357
1357
|
* when the list is reordered.
|
|
1358
1358
|
*
|
|
1359
1359
|
* @param source A `Signal<T[]>` or a function returning `T[]`.
|
|
1360
|
-
* @param mapFn The mapping function. Receives the item
|
|
1360
|
+
* @param mapFn The mapping function. Receives the item, its index as a Signal, and the
|
|
1361
|
+
* entry's key (the effective ordinal key when `duplicateKeys` is enabled, otherwise
|
|
1362
|
+
* the raw key) — stable for the lifetime of the mapped entry.
|
|
1361
1363
|
* @param options Optional configuration:
|
|
1362
1364
|
* - `onDestroy`: A callback invoked when a mapped item is removed from the array.
|
|
1363
1365
|
* - `key`: A custom key extractor for identity matching (e.g. `(item) => item.id`)
|
|
@@ -1387,7 +1389,7 @@ type DuplicateKeyPolicy = {
|
|
|
1387
1389
|
* users.set([users()[1], users()[0]]);
|
|
1388
1390
|
* ```
|
|
1389
1391
|
*/
|
|
1390
|
-
declare function keyArray<T, U, K>(source: Signal<T[]> | (() => T[]), mapFn: (v: T, i: Signal<number
|
|
1392
|
+
declare function keyArray<T, U, K>(source: Signal<T[]> | (() => T[]), mapFn: (v: T, i: Signal<number>, key: K | string) => U, options?: {
|
|
1391
1393
|
onDestroy?: (value: U) => void;
|
|
1392
1394
|
/**
|
|
1393
1395
|
* Optional function to use a custom key for item comparison.
|