mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +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>
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
import _includesWith from './internal/_includesWith.js';
|
|
import _curry3 from './internal/_curry3.js';
|
|
|
|
/**
|
|
* Finds the set (i.e. no duplicates) of all elements in the first list not
|
|
* contained in the second list. Duplication is determined according to the
|
|
* value returned by applying the supplied predicate to two list elements.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category Relation
|
|
* @sig ((a, a) -> Boolean) -> [a] -> [a] -> [a]
|
|
* @param {Function} pred A predicate used to test whether two items are equal.
|
|
* @param {Array} list1 The first list.
|
|
* @param {Array} list2 The second list.
|
|
* @return {Array} The elements in `list1` that are not in `list2`.
|
|
* @see R.difference, R.symmetricDifference, R.symmetricDifferenceWith
|
|
* @example
|
|
*
|
|
* const cmp = (x, y) => x.a === y.a;
|
|
* const l1 = [{a: 1}, {a: 2}, {a: 3}];
|
|
* const l2 = [{a: 3}, {a: 4}];
|
|
* R.differenceWith(cmp, l1, l2); //=> [{a: 1}, {a: 2}]
|
|
*/
|
|
var differenceWith = /*#__PURE__*/_curry3(function differenceWith(pred, first, second) {
|
|
var out = [];
|
|
var idx = 0;
|
|
var firstLen = first.length;
|
|
while (idx < firstLen) {
|
|
if (!_includesWith(pred, first[idx], second) && !_includesWith(pred, first[idx], out)) {
|
|
out.push(first[idx]);
|
|
}
|
|
idx += 1;
|
|
}
|
|
return out;
|
|
});
|
|
export default differenceWith; |