UNPKG

537 BJavaScriptView Raw
1/**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 */
9
10/* eslint-disable no-redeclare */
11// $FlowFixMe
12var find = Array.prototype.find ? function (list, predicate) {
13 return Array.prototype.find.call(list, predicate);
14} : function (list, predicate) {
15 for (var i = 0; i < list.length; i++) {
16 var value = list[i];
17
18 if (predicate(value)) {
19 return value;
20 }
21 }
22};
23export default find;
\No newline at end of file