Socket
Book a DemoInstallSign in
Socket

bisect-sorted-set

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bisect-sorted-set

An in memory sorted set that uses binary search on numeric indexes to find values next to each other

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

Bisect-Sorted-Set

An in memory sorted set that uses binary search on numeric indexes to find values next to each other.

Usage

var Set = require('bisect-sorted-set')

var set = new Set()

set.put(1000, {foo: 'bar'})
set.put(100001, {foo: 'baz'})

set.get(1000) -> {foo: 'bar'}
set.get(1001) -> null
set.gte(1000) -> {foo: 'bar'}
set.gt(1000) -> {foo: 'baz'}

Installation

$ npm install bisect-sorted-set

API

#put(idx, value)

Store value at idx.

#get(idx)

Get value at idx, if any.

#gt(idx)

Get value with index next greater than idx, if any.

#gte(idx)

Get value with index next greater than or equal to idx, if any.

#lt(idx)

Get value with index next lower than idx, if any.

#lte(id

Get value with index next lower than or equal to idx, if any.

#del(idx)

Delete value at idx, if any.

License

MIT

FAQs

Package last updated on 20 Mar 2017

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