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

Function takeNewKey

modules/entity/src/unsorted_state_adapter.ts:129–147  ·  view source on GitHub ↗
(
    keys: { [id: string]: any },
    update: Update<T>,
    state: any
  )

Source from the content-addressed store, hash-verified

127 state: R
128 ): void;
129 function takeNewKey(
130 keys: { [id: string]: any },
131 update: Update<T>,
132 state: any
133 ): boolean {
134 const original = state.entities[update.id];
135 const updated: T = Object.assign({}, original, update.changes);
136 const newKey = selectIdValue(updated, selectId);
137 const hasNewKey = newKey !== update.id;
138
139 if (hasNewKey) {
140 keys[update.id] = newKey;
141 delete state.entities[update.id];
142 }
143
144 state.entities[newKey] = updated;
145
146 return hasNewKey;
147 }
148
149 function updateOneMutably(update: Update<T>, state: R): DidMutate;
150 function updateOneMutably(update: any, state: any): DidMutate {

Callers 1

updateManyMutablyFunction · 0.85

Calls 1

selectIdValueFunction · 0.90

Tested by

no test coverage detected