refactor(runtime-dom): use findIndex instead of loop (#244)

This commit is contained in:
fisker Cheung 2019-10-13 07:32:47 +08:00 committed by Evan You
parent a7eefaff1e
commit 9371e65187

View File

@ -165,10 +165,7 @@ function setSelected(el: HTMLSelectElement, value: any) {
}
function looseIndexOf(arr: any[], val: any): number {
for (let i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) return i
}
return -1
return arr.findIndex(item => looseEqual(item, val))
}
// retrieve raw value set via :value bindings