Skip to content

OutSystems/immutable-records

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

immutable-records

npm version A simple implementation of immutable records for JavaScript.

The goal of this implementation is to have great performance dealing with records with a small, fixed set of attributes. See here for a performance comparision with Facebook's immutable-js.

This is the JavaScript version of the TypeScript version for use with npm.

Install (via NPM)

$ npm install immutable-records

Usage

var Record = require('immutable-records').Record;

var ABRecord = Record({a:1, b:2});
var myRecord = new ABRecord({b:3});

myRecord.get('b'); // 3

myRecord = myRecord.set('a', 4); // Returns a new Record
myRecord.get('a'); // 4

myRecord.toJS(); // Returns a vanilla JS Object { a: 4, b: 3 }

About

A simple implementation of immutable records.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published