@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.
|
@@ -2041,7 +2041,9 @@ function effectiveKeys(arr, getKey, report) {
|
|
|
2041
2041
|
* when the list is reordered.
|
|
2042
2042
|
*
|
|
2043
2043
|
* @param source A `Signal<T[]>` or a function returning `T[]`.
|
|
2044
|
-
* @param mapFn The mapping function. Receives the item
|
|
2044
|
+
* @param mapFn The mapping function. Receives the item, its index as a Signal, and the
|
|
2045
|
+
* entry's key (the effective ordinal key when `duplicateKeys` is enabled, otherwise
|
|
2046
|
+
* the raw key) — stable for the lifetime of the mapped entry.
|
|
2045
2047
|
* @param options Optional configuration:
|
|
2046
2048
|
* - `onDestroy`: A callback invoked when a mapped item is removed from the array.
|
|
2047
2049
|
* - `key`: A custom key extractor for identity matching (e.g. `(item) => item.id`)
|
|
@@ -2119,7 +2121,7 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
2119
2121
|
const indexSignal = signal(j, /* @ts-ignore */
|
|
2120
2122
|
...(ngDevMode ? [{ debugName: "indexSignal" }] : /* istanbul ignore next */ []));
|
|
2121
2123
|
newIndexes[j] = indexSignal;
|
|
2122
|
-
newMapped[j] = mapFn(item, indexSignal);
|
|
2124
|
+
newMapped[j] = mapFn(item, indexSignal, newKeys ? newKeys[j] : getKey(item));
|
|
2123
2125
|
}
|
|
2124
2126
|
}
|
|
2125
2127
|
else {
|
|
@@ -2173,7 +2175,7 @@ function keyArray(source, mapFn, options = {}) {
|
|
|
2173
2175
|
const indexSignal = signal(j, /* @ts-ignore */
|
|
2174
2176
|
...(ngDevMode ? [{ debugName: "indexSignal" }] : /* istanbul ignore next */ []));
|
|
2175
2177
|
newIndexes[j] = indexSignal;
|
|
2176
|
-
newMapped[j] = mapFn(newItems[j], indexSignal);
|
|
2178
|
+
newMapped[j] = mapFn(newItems[j], indexSignal, kNew(j));
|
|
2177
2179
|
}
|
|
2178
2180
|
}
|
|
2179
2181
|
items.length = newLen;
|