Immute
Description
Immute is a simple library intended for the creation of immutable value objects. If you want to know more about what immutable value objects are and why they a good thing have, please read the following article by Runway 7.
Installation
Immute is available from the NPM repository simply npm install immute
or add immute as a dependency in your package.json file.
Usage
Creating immutable object constructor
var immute = ; var Cat = ;
Object properties can be required or optional
var unknown = birthDate: "02.03.32" description: "fat homeless cat"; // ERROR: 'Required field missing from immutable object'
Object properties cannot be updated
var sheldon = name: "sheldon" birthDate: "02.04.2013"; //validsheldonname = "Leonard"; // ERROR: 'Immutable value object. Property cannot be changed'
Objects are closed so no additional parameters can be added
var cuddles = name: "cuddles" birthDate: "02.02.2012" description:"likes salmon"; //validcuddlesstatus = "sleeping"; Object; // ['name','birthDate','description']