Requesting to delete a word throws unexpected error
Closed this issue · 0 comments
indiesquidge commented
Requesting to delete a word with some matching prefix to an existing word throws a useful error
const completion = createTrie()
completion.insert('list')
completion.delete('lis') // throws `Error: foo is not a word, nothing deleted`
But if I request to delete a word with no matching prefix to an existing word, the error thrown is not helpful
const completion = createTrie()
completion.delete('foo') // throws `TypeError: Cannot read property 'getIsCompleteString' of undefined`
I would expect the latter snippet to throw the same error as the former snippet.