inheritable-map

1.0.2 • Public • Published

InheritableMap

Build Status codecov

Inheritable version of the Immutable.Map data type

Why?

are(you(tired(of(counting(parenthesis)))))? This package allows you to extend the Immutable.Map data type so.you.can.use.dot(notation)!

Installation

npm install --save inheritable-map

Usage

To inherit from Map in ES6 and add a toString override, do the following:

import { InheritableMap } from 'inheritable-map';
 
class Table extends InheritableMap {
  toString() {
    return this.__toString('Table {', '}');
  }
}

To do the same thing in ES5:

var InheritableMap = require('inheritable-map').InheritableMap;
 
function Table() {
  InheritableMap.prototype.constructor.apply(this, arguments);
}
Table.prototype = Object.create(InheritableMap.prototype);
 
Table.prototype.toString = function toString() {
  return this.__toString('Table {', '}');
}

Now you can construct an instance of your Map based class (ES5/ES6):

var table = new Table();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    2
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i inheritable-map

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jdfreder