0.0.6 • Published 9 years ago

bplus-index v0.0.6

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

bplus-index

npm version license build

A JavaScript implementation of a B+tree structure.

A B+tree is very useful for fast lookups, ranges and sorting.

NPM

js-standard-style

API

inject(key, value)

Adds a new value to the index at the given key.

ArgumentTypeDescription
KeyString or NumberThe key that the value will be indexed by
ValueString or NumberThe value stored at the given key

eject(key, value)

Removes a value from the index at the given key. If value is undefined, eject removes all values at the given key.

ArgumentTypeDescription
KeyString or NumberThe key where the value is stored
ValueString or NumberThe value to be removed

get(key)

Retrieves all values stored at given key

ArgumentTypeDescription
KeyString or NumberThe key to search for

getAll(options)

Gets all values from the index sorted by key.

ArgumentTypeDescription
optionsobjectsee below
options
nameTypeDescriptionDefault
sortDescendingBooleanSort values by key in descending orderFalse

getRange(lowerBound, upperBound, options)

getRange will return all values where that value's key is in the specified range

ArgumentTypeDescription
lowerBoundString or NumberThe lower boundary of the range
upperBoundString or NumberThe upper boundary of the range
optionsobjectsee below
options
nameTypeDescriptionDefault
lowerInclusiveBooleanInclude values where the key equals lowerBoundTrue
upperInclusiveBooleanInclude values where the key equals upperBoundFalse
sortDescendingBooleanSort values by key in descending orderFalse

Running mocha tests

npm test

Running performance tests

npm install -g babel

babel-node benchmark.js

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago