mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 19:41:12 +08:00
DISABLE_THIRD_PARTY_CHECK=new npm module causes package-lock change We can get rid of a custom script and use ESLint for these rules. Additionally this means editors will highlight the issue in the editor. Change-Id: I552b52e7f07b4e7430b3f685dbc3b5fad36ffff2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052167 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
var _curry2 = /*#__PURE__*/require('./internal/_curry2');
|
|
|
|
var _dispatchable = /*#__PURE__*/require('./internal/_dispatchable');
|
|
|
|
var _xfindIndex = /*#__PURE__*/require('./internal/_xfindIndex');
|
|
|
|
/**
|
|
* Returns the index of the first element of the list which matches the
|
|
* predicate, or `-1` if no element matches.
|
|
*
|
|
* Acts as a transducer if a transformer is given in list position.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.1
|
|
* @category List
|
|
* @sig (a -> Boolean) -> [a] -> Number
|
|
* @param {Function} fn The predicate function used to determine if the element is the
|
|
* desired one.
|
|
* @param {Array} list The array to consider.
|
|
* @return {Number} The index of the element found, or `-1`.
|
|
* @see R.transduce
|
|
* @example
|
|
*
|
|
* const xs = [{a: 1}, {a: 2}, {a: 3}];
|
|
* R.findIndex(R.propEq('a', 2))(xs); //=> 1
|
|
* R.findIndex(R.propEq('a', 4))(xs); //=> -1
|
|
*/
|
|
|
|
|
|
var findIndex = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable([], _xfindIndex, function findIndex(fn, list) {
|
|
var idx = 0;
|
|
var len = list.length;
|
|
while (idx < len) {
|
|
if (fn(list[idx])) {
|
|
return idx;
|
|
}
|
|
idx += 1;
|
|
}
|
|
return -1;
|
|
}));
|
|
module.exports = findIndex; |