immutable-inherit

0.2.2 • Public • Published

ImmutableInherit

This package provides a single class, ImmutableInherit, that can be used in Immutable collections, but be extended through inheritance. Specifically, it implements Immutable behavior for is, toJS(), etc.

It takes a single argument that can be:

  • An Immutable class (e.g. Map, List, OrderedMap, ...)
  • A JavaScript object
  • A JavaScript list

Whatever you pass as an argument to the constructor will be converted to an Immutable object (via fromJS) if it isn't already immutable (tested via isImmutable()). The argument will be available via the getData() method, or to subclasses via the _data property.

If called without an argument, the data element will be an empty Map.

Example

See the examples directory for demonstrations of how to use and extend ImmutableInherit.

Changelog

  • 0.1.0 - Initial publication
  • 0.2.0 - Now with 100% line / branch / statement coverage

Readme

Keywords

Package Sidebar

Install

npm i immutable-inherit

Weekly Downloads

2

Version

0.2.2

License

MIT

Unpacked Size

6.4 kB

Total Files

4

Last publish

Collaborators

  • wittlesouth