Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set(value, trigger) {
value = this.purifyValue(value)
if (!arrayEqual(value, this.value)) {
const unselected = arrayDiff(this.value, value)
const selected = arrayDiff(value, this.value)
this.value = value
selected.forEach(v => this.select(v, trigger, false))
unselected.forEach(v => this.unselect(v, trigger, false))
this.setValueForElement(value)
if (this.DROPDOWN) {
this.DROPDOWN.update()
}
if (value.length === 0) {
removeClass(this.classes.SELECTED, this.$wrap)
if (trigger) {
this.trigger(EVENTS.CLEAR)
}
set(value, trigger) {
value = this.purifyValue(value)
if (!arrayEqual(value, this.value)) {
const unselected = arrayDiff(this.value, value)
const selected = arrayDiff(value, this.value)
this.value = value
selected.forEach(v => this.select(v, trigger, false))
unselected.forEach(v => this.unselect(v, trigger, false))
this.setValueForElement(value)
if (this.DROPDOWN) {
this.DROPDOWN.update()
}
if (value.length === 0) {
removeClass(this.classes.SELECTED, this.$wrap)
if (trigger) {
this.trigger(EVENTS.CLEAR)