Provides a polyfill-style Map class compatible with legacy JavaScript environments such as Rhino or RingoJS.
The Map module implements an ES6-inspired key-value store with predictable iteration order,
offering modern APIs like set, get, delete, has, forEach, entries, and functional utilities.
It is designed for environments lacking native Map support, such as embedded test runners, script engines, or early JavaScript runtimes.
Core Features:
- Key-based storage with insertion-order tracking.
- Chainable and iterable methods including
forEach,map,reduce, andfilter. - Full support for functional transformations and merging/cloning operations.
- Compatible
keys(),values(),entries()for data traversal. - Custom sort methods:
sortKeys(),sortValues(), and ordering control viareverse().
Usage Overview:
- Instantiate with
const m = new Map(); - Add or update entries with
set(key, value) - Query data using
get(key),has(key), ordelete(key) - Use
forEach,entries, orreducefor iteration or processing
API Highlights:
set(key, value): Add or overwrite entriesget(key),has(key),delete(key): Access and manage keysmap(fn),filter(fn),reduce(fn, init): Functional utilitiesclone(),merge(map): Shallow copy and mergingsortKeys(fn),sortValues(fn),reverse(): Ordering and control