@otaxhu/orderedmap v0.3.0
Ordered Map
You can think of this OrderedMap as a regular JavaScript Map, but where you can get the previous and next elements of any of the entries in the OrderedMap without knowing their keys.
In fact OrderedMap extends Map standard JavaScript class, so you can use this implementation as a regular JavaScript Map.
Methods and Properties:
OrderedMapextendsMap, meaning that all of the methods and properties fromMapare also available with no behaviour change on them.See MDN Docs Map website for more information.
New methods
.getElement(key: K): Element<K, V> | undefinedGets an element with key
keypreviously setted (either through the constructor or.set()method), and returns an object with the following type:type Element<K, V> = { readonly key: K, readonly value: V, readonly nextElement?: Element<K, V>, readonly prevElement?: Element<K, V>, }Or
undefinedif an element with that key was not found in the OrderedMap..front(): Element<K, V> | undefinedReturns the first element in the OrderedMap as an
Element<K, V>object type, orundefinedif the OrderedMap is empty..back(): Element<K, V> | undefinedReturns the last element in the OrderedMap as an
Element<K, V>object type, orundefinedif the OrderedMap is empty.
Types
For more information on the type declarations, see the file orderedmap.d.ts