immutable and typed js data structures
npm install immutatoimmutable and typed js data structures
   

npm install immutato --save``javascript
var i = require('immutato');
//
// create a "shape"
//
var Person = i('Person', {
name: '',
surname: ''
},Person);
//
// object creation
//
var person = Person({name:'Andrea', surname:'Parodi'});
person.name().should.be.equal('Andrea')
person.surname().should.be.equal('Parodi')
//
// update a property
//
var renamed = person.name('Gianni');
renamed.name().should.be.equal('Gianni');
renamed.surname().should.be.equal('Parodi');
//
// previous version is still the same
//
person.name().should.be.equal('Andrea');
person.surname().should.be.equal('Parodi');
``
* 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
See DESIGN.md (TODO - update to current implementation concepts)
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.
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
* documentation - I will add, I promise.
* support - open an issue here.