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

binary-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

binary-map

in-memory key/value store based on binary search, that support buffers as keys

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

binary-map

In-memory key/value store based on a binary search, that supports buffers as keys.

example

var BinaryMap = require('binary-map')

var bm = BinaryMap()

bm.set(key, value)
value = bm.get(key)

API

bm = BinaryMap(comparator?)

create a new binary-map instance with the given comparator. By default typewiselite is used, which should be sufficent for most purposes.

BinaryMap#set(key, value)

set a key to a value

BinaryMap#add({key, value})

Like set, except add a pair of values. The object passed in will be used in the external datastructure, so do not mutate it after calling this.

BinaryMap#get(key)

return the value for key, or undefined

BinaryMap#has(key)

return true if key is stored.

i = BinaryMap#getIndex(key)

return the index key is stored at in the internal array. If return value is negative, key is not in the array. Since binary-map wraps binary-search ~i will be the value of the closest key (the item currently where this key would be if it was in the map)

BinaryMap#store

The internal array. Realize that if you mutate this you might break stuff if you do not preserve the order of the keys.

BinaryMap#toJSON()

Return a copy of the internal array. This does not clone the keys or values, so if you mutate something it could break.

License

MIT

FAQs

Package last updated on 24 Sep 2014

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