Simple Javascript Radix-Trie implementation
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md

README.md

Simple Javascript Radix-Trie (aka Patricia Trie/Crit Trie.)

Eg. var T = {}; add('josh', T); add('john', T); add('jonathan', T); // { jo: { sh: {}, hn: {}, nathan: {} } } closest_match('jos', T); // { upto: 'jo', near: { sh: {}, hn: {}, nathan: {} } }

Implementation tries to be JSON-safe; becuase of this, remove is naive:

    var T = {};
    add('jo', T);
    add('josh', T);
    // {'jo': {'sh': {}}}
    remove('josh', T);
    // {}