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

Function createCollection

modules/data/spec/entity-data.module.spec.ts:244–256  ·  view source on GitHub ↗
(
    entityName: string,
    data: T[]
  )

Source from the content-addressed store, hash-verified

242 };
243
244 function createCollection<T extends { id: any }>(
245 entityName: string,
246 data: T[]
247 ) {
248 return {
249 ...collectionCreator.create<T>(entityName),
250 ids: data.map((e) => e.id),
251 entities: data.reduce((acc, e) => {
252 acc[e.id] = e;
253 return acc;
254 }, {} as any),
255 } as EntityCollection<T>;
256 }
257}
258// #endregion

Callers 1

Calls 2

mapMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected