immutato
immutable and typed js data structures
Getting Started
Install the module with: npm install immutato --save
var i = ; //// create a "shape"//var Person = ; //// object creation//var person = ;personnameshouldbepersonshouldbe // // update a property//var renamed = personname'Gianni';renamednameshouldbe;renamedshouldbe; //// previous version is still the same//personnameshouldbe;personshouldbe;
Features
- Immutable data structure
- Setter methods to create a new immutable object with updated data
- Getter methods to retrieve property values
- Idempotent types (TODO - not implemented)
- Minimize object copy using WeakMap.
- Very fast
Design
See DESIGN.md (TODO - update to current implementation concepts)
Status
This is version 0.3 of the module. It is a complete rewrite, so maybe it contains weird things like bugs or snakes. Version 0.2 is still available here. It is a bit more stable but not very performant.
Performance
It appear to be very fast. I wrote benchmarks to compare it with Immutable, Ancient Oak and plain old JavaScript objects (using Object.freeze). They are a bit biased (written by me) and cover really simple use cases, but it sound promises
You can see my benchmarks here
Other stuff
- documentation - I will add, I promise.
- support - open an issue here.
License
MIT © 2014, Andrea Parodi