No empty string words / allow 1 character search

If a  space character is at either end of the input string splitting it
procuces an empty string that matches everything.

Allow single character words as there are is a single character tag: `x`
This commit is contained in:
Maximilian Krög
2020-07-12 15:17:51 +02:00
parent b41a43cb7f
commit 856830b834

View File

@@ -25,7 +25,8 @@
}
function getMatchingExamples(text) {
if (text.length < 2) {
text = text.trim();
if (text.length === 0) {
return info.examples;
}
const words = text.split(/\W+/);