@clarketm/supermap

Map with superpowers! 💪

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
@clarketm/supermap
Minified + gzip package size for @clarketm/supermap in KB

Readme

Map

NPM release

Map with superpowers! 💪

This data structure inherit all methods and properties from the Map built-in.

Individual Module Installation

Yarn

$ yarn add @clarketm/supermap

Npm

$ npm install @clarketm/supermap --save

API

constructor(iterable: Iterable)

Construct a Map

some(callback: Callback): boolean

Tests whether at least one element in the map passes the test implemented by the provided function

Name Type Attribute Description
callback Callback callback function

every(callback: Callback): boolean

Test whether all elements in the map pass the test implemented by the provided function

Name Type Attribute Description
callback Callback callback function

setDefault(key: Item, defaultValue: Item): Item

Similar to get(), but will set key to defaultValue if key is not already in Map.

Name Type Attribute Description
key Item Map key
defaultValue Item the default value to set in Map if the key is not defined

toObject(): object

Convert Map to an Object

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.