Skip to content

Instantly share code, notes, and snippets.

@Tombarr
Tombarr / Trie.js
Last active June 25, 2023 21:48 — forked from tpae/Trie.js
Trie.js - super simple JavaScript implementation
// Trie.js - super simple JS implementation
// https://en.wikipedia.org/wiki/Trie
// From https://gist.github.com/tpae/72e1c54471e88b689f85ad2b3940a8f0
// Modified to support key -> value mapping for quick object retrieval,
// using an ES6 Map instead of plain JS object, and optional case insensitivity.
// Values are automatically converting to arrays to support multiple values
// mapped to a single tree leaf.
// Example: