🐙 trie based suggestions microlibrary
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
media
plugins
test
.gitignore
README.md
bower.json
octopi.js

README.md

octopi.js

Micro (0.5kB) trie based suggestion generating library, made with autocompletion, control, and performance on mobile browsers in mind. Check out the demo.

var oct = new Octopi(['bird', 'boy']);
oct.add('bid', {'word': 'BID'});
oct.get('bi');   // => ['bird', {'word':'BID'}]

Do you even normalise?

Octopi allows for arbitrary data to be associated with words added to the tree. This means that you have full control over normalisation of the words. For example:

word = 'CoolUseRName';
oct.add(word.toLowerCase(), word);
oct.get(word.toLowerCase());

Deleting entries

You can use the delete plugin:

oct.delete('bid');

Installation

$ bower install eugenee-eeo/octopi