Skip to content

Commit a5f6add

Browse files
committed
Updated with Magnum5234 tip
1 parent b03868c commit a5f6add

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/Select.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -904,18 +904,12 @@
904904
* @return {Boolean} True when selected | False otherwise
905905
*/
906906
isOptionSelected(option) {
907-
let selected = false
908-
let i = 0
909-
while (!selected && i < this.valueAsArray.length) {
910-
let value = this.valueAsArray[i]
907+
return this.valueAsArray.some(value => {
911908
if (typeof value === 'object') {
912-
selected = this.optionObjectComparator(value, option)
913-
} else if (value === option || value === option[i]) {
914-
selected = true
909+
return this.optionObjectComparator(value, option)
915910
}
916-
i++
917-
}
918-
return selected
911+
return value === option || value === option[this.index]
912+
})
919913
},
920914
921915
/**

0 commit comments

Comments
 (0)