GitHub package.json versionTypeScriptNPM
GitHub package.json versionTypeScriptNPM

Accessing AutoImmutable Data

Any AutoImmutable instance communicates with its environment through its own Connection class (the consumer) instances.
The get(...) method of the Connection instance provides the means of accessing and obtaining Immutable data.
This method is variadic accepting only property path argument(s).
Pro tip:
The data returned from this method is a snapshot of the AutoImmutable instance data at the time of access.
This snapshot data is not affected by further updates to the AutoImmutable instance data.
Any further alterations to the snapshot data do not reach the AutoImmutable instance.

Example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import AutoImmutable from 'auto-immutable'; const aImmutable = new AutoImmutable({ a: { b: 5, c: [ 6, { d: 7, e: 8, f: 9 } ] } }); const consumer = aImmutable.connect(); consumer.get( 'a.c[1]', 'b' ); // returns: // { // 'a.c[1]': { // d: 7, // e: 8, // f: 9 // }, // b: 5 // }