Auto Immutable JS is a self enforcing immutable class. Its internal data are private and readonly.
It provides Consumer instances through which it can be read and updated.
@webkrafters/auto-immutable
Alternate: auto-immutable.js
npm install --save @webkrafters/auto-immutable
Please see Full documentation before using. Recommended.
/* my-immutable.ts */
import AutoImmutable from '@webkrafters/auto-immutable';
const initValue = { a: { b: { c: 24 } } };
const aImmutable = new Immutable( initValue );
export default aImmutable;
/* read-my-immutable.ts */
import myImmutable from './my-immutable';
const consumer = myImmutable.connect();
const objectPath = 'a.b.c';
const data : AccessorResponse = consumer.get( objectPath );
console.log( data ); // { 'a.b.c', 24 }
consumer.disconnect();
myImmutable.close();
MIT