I encountered an error when trimming the string here - .trim() was not defined, meaning the str variable was not a string.
Simply checking for the existence of trim above solved the problem, e.g.
if (!str || !str.trim) {
return false
}
I have not thoroughly tested, and I do not know why str is sometimes not defined correctly in my case... but this looks like an easy added check and may be useful for others.
I encountered an error when trimming the string here -
.trim()was not defined, meaning thestrvariable was not a string.Simply checking for the existence of trim above solved the problem, e.g.
I have not thoroughly tested, and I do not know why
stris sometimes not defined correctly in my case... but this looks like an easy added check and may be useful for others.