瀏覽代碼

Revert "Update util find (#1205)" (fix #1286)

This reverts commit e556943cec8eb33881534f70c546a2f9e5321407.
ktsn 7 年之前
父節點
當前提交
273bf86b33
共有 1 個文件被更改,包括 1 次插入9 次删除
  1. 1 9
      src/util.js

+ 1 - 9
src/util.js

@@ -7,15 +7,7 @@
  * @return {*}
  */
 export function find (list, f) {
-  const { length } = list
-  let index = 0
-  let value
-  while (++index < length) {
-    value = list[index]
-    if (f(value, index, list)) {
-      return value
-    }
-  }
+  return list.filter(f)[0]
 }
 
 /**