powerful-map

1.0.0 • Public • Published

PowerfulMap

A powerful version of WeakMap. Infamous joke, of course

Install

npm i powerful-map
# or 
yarn add powerful-map

Using

const p = PowerfulMap();
 
p.set({ object: "0" }, "value0");
p.set({ object: "1" }, "value1");
p.set({ object: "2" }, "value2");
p.set({ object: "3" }, "value3");
 
p.get({ object: "3" }, "value3") === "value3"; // true
p.has({ object: "3" }); // true

Why PowerfulMap?

Powerful Map use Symbol to compare object key as values. But this method is not perfect for complex objects and not effective to differentiate types in object values (your key).

const p = PowerfulMap();
 
p.set({ object: "0" }, "value0");
p.has({ object: 0 }) // true

This case is valid, but if the type is important to your object so you have a bug :D

ToDo

  • [] Performer way to compare keys with reliability on type in values of object

Readme

Keywords

none

Package Sidebar

Install

npm i powerful-map

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

7.79 kB

Total Files

6

Last publish

Collaborators

  • g4rcez