JSPM

bignumbertreemap-js

0.5.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q16875F
  • License MIT

A binary tree based map (aka dictionary) data type for Javascript, keeping keys sorted at all times

Package Exports

  • bignumbertreemap-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bignumbertreemap-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TreeMap.js

A binary tree based map (aka dictionary) data type for Javascript, keeping keys sorted at all times. Provides O(log n) average case performance for inserting, retrieving and removing values.

Installation

Works with Node and in the browser.

Node

Install via npm install treemap-js. Then access the TreeMap like this:

const TreeMap = require("treemap-js");

Browser

Include TreeMap.js in your HTML. TreeMap is automatically appended to the window object.

Usage

var map = new TreeMap();

map.set("my first key", "hello");    // keys can be strings, numbers or booleans. Values can be any data type
map.set("second key", [ 1, 3, 4 ]);
map.get("my first key");    // returns "hello"

map.set("my first key", 2342);
map.get("my first key");    // returns 2342

map.getLength();    //  returns 2

map.getMinKey();    // returns "my first key"
map.getMaxKey();    // returns "second key"

map.each(function (value, key) {
    // do something...
});

map.remove("my first key");
map.getLength();    // returns 1

map.getTree();    // returns the backing tree object