refactor(runtime-dom): use findIndex
instead of loop (#244)
This commit is contained in:
parent
a7eefaff1e
commit
9371e65187
@ -165,10 +165,7 @@ function setSelected(el: HTMLSelectElement, value: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function looseIndexOf(arr: any[], val: any): number {
|
function looseIndexOf(arr: any[], val: any): number {
|
||||||
for (let i = 0; i < arr.length; i++) {
|
return arr.findIndex(item => looseEqual(item, val))
|
||||||
if (looseEqual(arr[i], val)) return i
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrieve raw value set via :value bindings
|
// retrieve raw value set via :value bindings
|
||||||
|
Loading…
Reference in New Issue
Block a user