javascript - OrderedMap wrapper class does not work -
i've created below wrapper class in js. while trying call set method new maxorderedmap(3).set('adam', 'hello');. not called ovreridden method i've created in below class. can here?
import { orderedmap } 'immutable'; export default class maxorderedmap extends orderedmap { constructor(size) { super(); this.maxsize = size; } set(key, value) { const map = this.size >= this.maxsize ? this.rest() : this; return map.super.set(key, value); } }
this not possible mentioned here: https://github.com/facebook/immutable-js/issues/301.
you can use project wraps immutable instance inside object: https://github.com/philpl/extendable-immutable
Comments
Post a Comment