JSFiddle - React, Tailwind, and code Playground
by LyndseyB
Babel + JSX
const Factory = () => {
let _trie = {};
function addWord(word) {
// add word to trie
return true;
}
return {
init(arrayOfWords) {
arrayOfWords.forEach(word, addWord);
return _trie;
},
get() {
return _trie;
},
contains(entry, trie = _trie) {
const node = trie;
return true;
}
};
};