mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-31 13:02:17 +02:00
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:
commit
ac2def86af
|
@ -1161,7 +1161,7 @@ class Choices {
|
||||||
|
|
||||||
// If no duplicates are allowed, and the value already exists
|
// If no duplicates are allowed, and the value already exists
|
||||||
// in the array
|
// 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 (
|
if (
|
||||||
!isUnique &&
|
!isUnique &&
|
||||||
|
|
Loading…
Reference in a new issue