Socket
Socket
Sign inDemoInstall

iterable-keyed-map

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    iterable-keyed-map

TS/JS Map-like data structure using iterables as keys


Version published
Maintainers
1
Created

Readme

Source

iterable-keyed-map

This package is a Typescript-rewriting of anko/array-keyed-map. With some additional tweakings and features.

import { IterableKeyedMap } from "iterable-keyed-map";

// init
const ikmap = new IterableKeyedMap<string, string | number>();

// set
ikmap.set(["1", "2", "3"], 1);
ikmap.set(["1", "2"], 2);
ikmap.set(["3", "2", "1"], "random string");

// get
console.log(ikmap.get(["1", "2"]));
console.log(ikmap.get(["1", "2", "3"]));
console.log(ikmap.get(["3", "2", "1"]));

// iterate (in insertion order)
console.log([...ikmap]);

// delete
ikmap.delete(["1", "2"]);

// iterate
console.log([...ikmap]);

Features

Todos

  • Support custom comparison functions.
  • Unit tests.
  • Code minification. (use esm.run)

Keywords

FAQs

Last updated on 12 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc