Wrapper classes around Immutable.js that turn it inheritable
About
Ever wished that you could have OrderedMaps, Maps or Lists with extra methods,
that make your life easier? .ofCourse()
!
Getting Started
Installing the latest version via npm takes just a second:
npm install --save extendable-immutable
Import the default:
import Extendable from 'extendable-immutable'
class Collection extends Extendable.OrderedMap {
Or import only parts of it:
import { OrderedMap } from 'extendable-immutable'
class Collection extends OrderedMap {
Quick Intro
import { OrderedMap } from 'extendable-immutable'
class Collection extends OrderedMap {
static isCollection(val) {
return val && val instanceof Collection;
}
doMagic() {
return this.map(x => x.set("magic", true));
}
}
const magic = new Collection();
magic instanceof Immutable.OrderedMap;
Immutable.OrderedMap.isOrderedMap(magic);