MCPcopy
hub / github.com/angular/angular / iterableDifferToString

Function iterableDifferToString

packages/core/test/change_detection/util.ts:20–59  ·  view source on GitHub ↗
(iterableChanges: IterableChanges<V>)

Source from the content-addressed store, hash-verified

18import {stringify} from '../../src/util/stringify';
19
20export function iterableDifferToString<V>(iterableChanges: IterableChanges<V>) {
21 const collection: string[] = [];
22 iterableChanges.forEachItem((record: IterableChangeRecord<V>) =>
23 collection.push(icrAsString(record)),
24 );
25
26 const previous: string[] = [];
27 iterableChanges.forEachPreviousItem((record: IterableChangeRecord<V>) =>
28 previous.push(icrAsString(record)),
29 );
30
31 const additions: string[] = [];
32 iterableChanges.forEachAddedItem((record: IterableChangeRecord<V>) =>
33 additions.push(icrAsString(record)),
34 );
35
36 const moves: string[] = [];
37 iterableChanges.forEachMovedItem((record: IterableChangeRecord<V>) =>
38 moves.push(icrAsString(record)),
39 );
40
41 const removals: string[] = [];
42 iterableChanges.forEachRemovedItem((record: IterableChangeRecord<V>) =>
43 removals.push(icrAsString(record)),
44 );
45
46 const identityChanges: string[] = [];
47 iterableChanges.forEachIdentityChange((record: IterableChangeRecord<V>) =>
48 identityChanges.push(icrAsString(record)),
49 );
50
51 return iterableChangesAsString({
52 collection,
53 previous,
54 additions,
55 moves,
56 removals,
57 identityChanges,
58 });
59}
60
61function icrAsString<V>(icr: IterableChangeRecord<V>): string {
62 return icr.previousIndex === icr.currentIndex

Callers 1

Calls 9

icrAsStringFunction · 0.85
iterableChangesAsStringFunction · 0.85
forEachItemMethod · 0.65
forEachPreviousItemMethod · 0.65
forEachAddedItemMethod · 0.65
forEachMovedItemMethod · 0.65
forEachRemovedItemMethod · 0.65
forEachIdentityChangeMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…