Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iterable-keyed-map

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iterable-keyed-map

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

  • 1.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 12 Nov 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc