MCPcopy Create free account
hub / github.com/ngrx/platform / updateManyMutably

Function updateManyMutably

modules/entity/src/unsorted_state_adapter.ts:155–176  ·  view source on GitHub ↗
(updates: any[], state: any)

Source from the content-addressed store, hash-verified

153
154 function updateManyMutably(updates: Update<T>[], state: R): DidMutate;
155 function updateManyMutably(updates: any[], state: any): DidMutate {
156 const newKeys: { [id: string]: string } = {};
157
158 updates = updates.filter((update) => update.id in state.entities);
159
160 const didMutateEntities = updates.length > 0;
161
162 if (didMutateEntities) {
163 const didMutateIds =
164 updates.filter((update) => takeNewKey(newKeys, update, state)).length >
165 0;
166
167 if (didMutateIds) {
168 state.ids = state.ids.map((id: any) => newKeys[id] || id);
169 return DidMutate.Both;
170 } else {
171 return DidMutate.EntitiesOnly;
172 }
173 }
174
175 return DidMutate.None;
176 }
177
178 function mapMutably(map: EntityMap<T>, state: R): DidMutate;
179 function mapMutably(map: any, state: any): DidMutate {

Callers 3

updateOneMutablyFunction · 0.70
mapMutablyFunction · 0.70
upsertManyMutablyFunction · 0.70

Calls 2

takeNewKeyFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected