When using YASQE in an environment where the Array object has been extended (in my case this is done by Ember.js, which I use), the prefix autocompleter causes the following error to be thrown:
Uncaught TypeError: child.getAllWords is not a function
at module.exports.getAllWords (trie.js:235)
[...]
This happens for instance when writing rdfs: in the editor and expecting YASQE to add the corresponding prefix to the current query. It chokes when hitting the ROOT() of the Trie.
One solution that worked in my case is to perform a safer iteration of T.children properties in the getAllWords function using the standard hasOwnProperty check:
for(k in T.children) {
if (T.children.hasOwnProperty(k)){
child = T.children[k];
ret = ret.concat(child.getAllWords(str + k));
}
}
When using YASQE in an environment where the Array object has been extended (in my case this is done by Ember.js, which I use), the prefix autocompleter causes the following error to be thrown:
This happens for instance when writing
rdfs:
in the editor and expecting YASQE to add the corresponding prefix to the current query. It chokes when hitting the ROOT() of the Trie.One solution that worked in my case is to perform a safer iteration of T.children properties in the getAllWords function using the standard
hasOwnProperty
check: