Merge pull request #175 from adamsro/bugfix/trim-is-not-a-function

Check `item.value` is type 'string' before calling `trim()`
This commit is contained in:
Josh Johnson 2017-05-30 19:54:33 +01:00 committed by GitHub
commit ac2def86af

View file

@ -1161,7 +1161,7 @@ class Choices {
// If no duplicates are allowed, and the value already exists
// in the array
const isUnique = !activeItems.some((item) => item.value === value.trim());
const isUnique = !activeItems.some((item) => item.value === isType('String', value) ? value.trim() : value);
if (
!isUnique &&