MCPcopy Create free account
hub / github.com/tinyplex/tinybase / mapClone

Function mapClone

src/common/map.ts:130–137  ·  view source on GitHub ↗
(
  map: IdMap<MapValue> | undefined,
  mapValue?: (mapValue: MapValue) => MapValue,
)

Source from the content-addressed store, hash-verified

128 );
129
130export const mapClone = <MapValue>(
131 map: IdMap<MapValue> | undefined,
132 mapValue?: (mapValue: MapValue) => MapValue,
133): IdMap<MapValue> => {
134 const map2: IdMap<MapValue> = mapNew();
135 collForEach(map, (value, key) => map2.set(key, mapValue?.(value) ?? value));
136 return map2;
137};
138
139export const mapClone2 = <MapValue>(map: IdMap2<MapValue> | undefined) =>
140 mapClone(map, mapClone);

Callers 6

clonedChangedCellsFunction · 0.90
mapClone2Function · 0.70
mapClone3Function · 0.70

Calls 2

collForEachFunction · 0.90
mapNewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…