Check value is type string before calling trim()

This commit is contained in:
Marshall Adams 2017-05-30 10:43:25 -07:00
parent 1b8621b54e
commit 110796e25f

View file

@ -1111,7 +1111,7 @@ class Choices {
}
if (this.passedElement.type === 'text' && this.config.addItems && canAddItem) {
const isUnique = !activeItems.some((item) => item.value === value.trim());
const isUnique = !activeItems.some((item) => item.value === isType('String', value) ? value.trim() : value);
// If a user has supplied a regular expression filter
if (this.config.regexFilter) {