mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-09 00:56:34 +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
|
||||
// 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 &&
|
||||
|
|
Loading…
Reference in a new issue