0.0.9 • Published 7 years ago

ohamt v0.0.9

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

ohamt

Ordered Hash array mapped trie

Forked from https://github.com/mattbierner/hamt_plus

This HAMT maintains insertion order and provides multi-map methods.

Install

ES6 source code is in src/ohamt.js. The library supports node, AMD, and use as a global, as long as your platform supports ES6. TODO: bablify.

Node

$ npm install ohamt
var hamt = require('ohamt');

var h = hamt.empty.set('key', 'value');

...

Extended API (Extends HAMT_PLUS)

map.append(key, value)

  • value - Value to store. Hamt supports all value types, including: literals, objects, falsy values, null, and undefined. Keep in mind that only the map data structure itself is guaranteed to be immutable. Using immutable values is recommended but not required.
  • key - String key.
  • map - Hamt map.

Returns a new map with the value set. If the key already existed, the entry will be moved to the 'end' of the map. Does not alter the original.


map.push(kv)

  • kv - Array of String key and Any value to store.
  • map - Hamt map.

Returns a new map with the value added. If the key already existed, the original entry will not be removed. The new entry will be added to the 'end' of the map. Does not alter the original. The method uses an array to mimic array push.


0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago