Socket
Socket
Sign inDemoInstall

hypermap

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hypermap

Like a BiMap, but with N values instead of pairs


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Install size
4.05 kB
Created
Weekly downloads
 

Readme

Source

HyperMap

A more generic version of BiMap (as seen in C++ Boost, Google), that associates two or more values together, such that only one is required to recall all others.

Install

npm install --save hypermap

API

new HyperMap([iterable])

iterable is an Array or other iterable object whose elements are tuples (arrays). Each item in each tuple is added to the new HyperMap. null is treated as undefined.

HyperMap.prototype.associate(items...)

Associates two or more items. Throws if less than two arguments are passed. If neither item exists in the HyperMap, creates a new association, otherwise adds the items to the existing association. Throws if you try to associate an item already present in another association.

Returns the HyperMap object.

HyperMap.prototype.disassociate(ref, itemsToRemove...)

Disassociate items. Selects an association based on ref, then removes items from it as directed. Does nothing if an association is not found. If, as a result of this method, an association now has less than two items, it is destroyed.

Returns the HyperMap object.

HyperMap.prototype.get(ref)

Returns the association that contains ref, as a Set, or undefined if not found.

HyperMap.prototype.has(ref)

Returns a boolean indicating whether ref is in the HyperMap.

License

Copyright © 2015 Félix Saparelli, licensed under MIT

Keywords

FAQs

Last updated on 14 Oct 2015

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