New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bidi-map

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bidi-map

A library that extends native ES6 Map to bi-directional map.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

view on npm Build Status Dependency Status codecov npm license

Bidi-map

A library that extends native ES6 Map to bi-directional map.

Install

npm install bidi-map

Usage

const BidiMap = require('bidi-map');

const bidiMap = new BidiMap([
  [1, 'test'],
  ['foo', 'bar'],
]);

bidiMap instanceof BidiMap; // true
bidiMap instanceof Map; // true

bidiMap.get(1); // "test"
bidiMap.has('foo'); // true
bidiMap.exists('bar'); // true
bidiMap.getKeyOf('test'); // 1

const key = Symbol('unique');
bidiMap.set(key, 'test');
bidiMap.getKeysOf('test'); // [1, key]

API Reference

A Bidirectional Map

BidiMap ⇐ Map

Kind: Exported class
Extends: Map
Template: K, V

new BidiMap([iterable])

Create a new instance of the bidirectional-map

ParamTypeDescription
[iterable]Iterable.<Array>An iterable object

bidiMap.count : number

Get the number of differed values in this map

Kind: instance property of BidiMap
Read only: true

bidiMap.set(key, value) ⇒ Map.<K, V>

Inherits from Map.set method.

Kind: instance method of BidiMap

ParamType
keyK
valueV

bidiMap.exists(value) ⇒ boolean

Check if the map has the given value.

Kind: instance method of BidiMap

ParamTypeDescription
valueVThe given value

bidiMap.getKeyOf(value) ⇒ K

Get the first key of the given value or undefined if not exists.

Kind: instance method of BidiMap

ParamType
valueV

bidiMap.getKeysOf(value) ⇒ Array.<K>

Get the all the keys of the given value.

Kind: instance method of BidiMap

ParamType
valueV

bidiMap.delete(key) ⇒ boolean

Inherits from Map.delete method.

Kind: instance method of BidiMap

ParamType
keyK

bidiMap.clear() ⇒ undefined

Inherits from Map.clear method.

Kind: instance method of BidiMap

© 2017 Moshe Simantov

Licensed under the Apache License, Version 2.0.

Keywords

bidirectional

FAQs

Package last updated on 01 Jun 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