@strong-roots-capital/map-objects
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

map-objects

Build Status

Map key-value pairs treating deeply-equal keys as equivalent objects

[!NOTE] This project is functional, but not actively maintained. Please feel free to fork it!

Install

npm install @strong-roots-capital/map-objects

This module uses the following settings in tsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "downlevelIteration": true
  }
}

Use

import mapObjects from "@strong-roots-capital/map-objects";
import deepEqual from "deep-equal";

const a = { a: 1, b: 2, c: 3 };
const b = { c: 3, b: 2, a: 1 };
console.log("a, b are equal:", deepEqual(a, b));

const value = "horse";

const map = new Map();
map.set(a, value);
console.log("map does not find value with deeply-equal object:", map.get(b));

const mapObject = new MapObjects();
mapObject.set(a, value);
console.log(
  "mapObject does find value with deeply-equal object:",
  mapObject.get(b),
);

Acknowledgments

Related

Package Sidebar

Install

npm i @strong-roots-capital/map-objects

Weekly Downloads

0

Version

1.1.1

License

ISC

Unpacked Size

4.86 kB

Total Files

4

Last publish

Collaborators

  • hamroctopus
  • amchelle