recursionbane / trie

A Trie in Javascript with shell-style string collapse

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trie.js

A Trie in Javascript

This fork enables a new method: collapse() Collapsing a trie converts its elements into a shell-style expansion string

A convenience method exists exposing just this functionality using a throwaway object:

let trie = new Trie;
console.log('Collapsed trie is: "' + trie.collapseFromArray(['spill', 'spall', 'spell']) + '"');
// "sp{ill,all,ell}"

This behavior should mirror Bash's reverse completion 'complete-into-braces' readline command, activated interactively using Meta + { (typically Alt + Left-Curly)

About

A Trie in Javascript with shell-style string collapse


Languages

Language:JavaScript 99.1%Language:HTML 0.9%