var createTrie = require('autosuggest-trie');
var splitByHyphen = /\s+|-/;
var universities = [{ name: 'University of Tennessee-Knoxville' }];
const trie = createTrie(universities, 'name', { splitRegex: splitByHyphen });
console.log(trie.getMatches('tennessee-', { limit: 15, splitRegex: splitByHyphen }));
The error is:
C:\Users\Yunyu\Documents\VHF2017-landingpage\node_modules\autosuggest-trie\dist\create-trie\create-trie.js:79
var length = ids.length;
^
TypeError: Cannot read property 'length' of undefined
at getWordIndices (C:\Users\Yunyu\Documents\VHF2017-landingpage\node_modules\autosuggest-trie\dist\create-trie\create-trie.js:79:21)
at getPhraseIndices (C:\Users\Yunyu\Documents\VHF2017-landingpage\node_modules\autosuggest-trie\dist\create-trie\create-trie.js:107:43)
at Object.getMatches (C:\Users\Yunyu\Documents\VHF2017-landingpage\node_modules\autosuggest-trie\dist\create-trie\create-trie.js:116:19)
trie\dist\create-trie\create-trie.js:116:19)
It doesn't occur when searching for a string like "of " or "tennessee-k", which is strange.
I get an error with the following code:
The error is:
It doesn't occur when searching for a string like "of " or "tennessee-k", which is strange.