npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jsclass-map

v0.1.3

Published

Simple map class.

Readme

Build Status

jsclass-map

Simple map class for general purpose.

What Makes "jsclass-map" Unique

"jsclass-map" supports logical operations between two maps like "or", "and", "xor". Since those methods returns "jsclass-map" object, developers can chain logical operations to create a new map, along with clear(), set(), setAll() and remove() methods.

How to Use

Just create a object, using class exported by the module. For more information, please visit GitHub for complete api documentation, under "doc" folder or API.md.

const Map  = require("jsclass-map");

let map = new Map();

map.set("k1", 1);
let val = map.get("k1");

API

Modules

Classes

Functions

jsclass-map

Simple map class, which support logical operator.

Map

Kind: global class

map.clear() ⇒ Map

Remove all elements.

Kind: instance method of Map
Returns: Map - This Map

map.isEmpty() ⇒ Boolean

Check if the map has no element.

Kind: instance method of Map
Returns: Boolean - If map has no element, then true.

map.size() ⇒ Number

Count elements in map.

Kind: instance method of Map
Returns: Number - Count of elements in map.

map.set(key, val) ⇒ Map

Set element to map. If the map already has a same key, old value will be over written by aruguments value. Key may take any object, but null and undefined.

Kind: instance method of Map
Returns: Map - This Map

| Param | Type | Description | | --- | --- | --- | | key | any | Key of the element to set. | | val | any | Value of th element to set. |

map.setAll(it) ⇒ Map

Set all elemetns in given iterator to map. All elements in the Iterator should have "key" and "value" as property.

Kind: instance method of Map
Returns: Map - This Map

| Param | Type | Description | | --- | --- | --- | | it | iterator | Iteratable object with valid elements. |

map.get(key) ⇒ any

Returns the value associated with key. If key is not present in map, then undefined will be returned.

Kind: instance method of Map
Returns: any - Associated value.

| Param | Type | Description | | --- | --- | --- | | key | any | Key of an element tobe located. |

map.remove(key) ⇒ Map

Remove element, with given key. If key is not present in map, then nothing happens.

Kind: instance method of Map
Returns: Map - This Map

| Param | Type | Description | | --- | --- | --- | | key | any | Key of an element to remove. |

map.has(key) ⇒ Boolean

Check if given key is present in map

Kind: instance method of Map
Returns: Boolean - If present, then true.

| Param | Type | Description | | --- | --- | --- | | key | any | Key to check. |

map.hasValue(v) ⇒ Boolean

Check if given value is present in map

Kind: instance method of Map
Returns: Boolean - If present, then true.

| Param | Type | Description | | --- | --- | --- | | v | any | value to check. |

map.keys() ⇒ Array

Returns an array of key, contains in map.

Kind: instance method of Map
Returns: Array - Array of keys.

map.or(map) ⇒ Map

Merge two maps and create a new map. When both maps have elements with same key, vallues are set to match argument map.

Kind: instance method of Map
Returns: Map - Result map.

| Param | Type | Description | | --- | --- | --- | | map | Map | Map to operate. |

map.and(map) ⇒ Map

Extract common elements between original map and argument maps. Values are set to match argument map.

Kind: instance method of Map
Returns: Map - Result map.

| Param | Type | Description | | --- | --- | --- | | map | Map | Map to operate. |

map.xor(map) ⇒ Map

Merge elements with unique keys between original and argument map. Result Map will be exactly the same map as, sustarcting the intersection from the union of original and argument maps.

Kind: instance method of Map
Returns: Map - Result map.

| Param | Type | Description | | --- | --- | --- | | map | Map | Map to operate. |

map.diffVal(map) ⇒ Map

Extract elements between twu maps, which have common key but different values.

Kind: instance method of Map
Returns: Map - Result map.

| Param | Type | Description | | --- | --- | --- | | map | Map | Map to compare. |

constructor(it)

Creates map object. You may pass itereator to initialize map at creation. Iterator should contain objects with "key" and "value" property.

Kind: global function

| Param | Type | | --- | --- | | it | Iterator |