1.0.3 • Published 5 months ago
@webkrafters/auto-immutable v1.0.3
Auto Immutable JS
Introduction
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.
Name:
@webkrafters/auto-immutable Alternate: auto-immutable.js
Installation
npm install --save @webkrafters/auto-immutable
Quick Start
Please see Full documentation before using. Recommended.
Obtain an Immutable Instance
/* my-immutable.ts */
import AutoImmutable from '@webkrafters/auto-immutable';
const initValue = { a: { b: { c: 24 } } };
const aImmutable = new AutoImmutable( initValue );
export default aImmutable;
Connect to an AutoImmutable Instance
/* read-my-immutable.ts */
import myImmutable from './my-immutable';
const consumer = myImmutable.connect();
const objectPaths = [ 'a.b.c', 'a.b' ];
const data : AccessorResponse = consumer.get( ...objectPaths );
// => data = {
// 'a.b': { c: 24 },
// 'a.b.c': 24
// }
Manually Discard an AutoImmutable Consumer.
consumer.disconnect();
Manually Discard an AutoImmutable Instance.
myImmutable.close();
License
MIT
1.0.3
5 months ago
1.0.2
1 year ago
1.0.2-rc.0
1 year ago
1.0.1
1 year ago
1.0.1-rc.0
1 year ago
1.0.0
1 year ago
0.0.2-rc.3
1 year ago
0.0.2-rc.1
1 year ago
0.0.2-rc.0
1 year ago
0.0.1
1 year ago