mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 17:27:22 +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>
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import _curry2 from './internal/_curry2.js';
|
|
import _Set from './internal/_Set.js';
|
|
|
|
/**
|
|
* Finds the set (i.e. no duplicates) of all elements in the first list not
|
|
* contained in the second list. Objects and Arrays are compared in terms of
|
|
* value equality, not reference equality.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category Relation
|
|
* @sig [*] -> [*] -> [*]
|
|
* @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.differenceWith, R.symmetricDifference, R.symmetricDifferenceWith, R.without
|
|
* @example
|
|
*
|
|
* R.difference([1,2,3,4], [7,6,5,4,3]); //=> [1,2]
|
|
* R.difference([7,6,5,4,3], [1,2,3,4]); //=> [7,6,5]
|
|
* R.difference([{a: 1}, {b: 2}], [{a: 1}, {c: 3}]) //=> [{b: 2}]
|
|
*/
|
|
var difference = /*#__PURE__*/_curry2(function difference(first, second) {
|
|
var out = [];
|
|
var idx = 0;
|
|
var firstLen = first.length;
|
|
var secondLen = second.length;
|
|
var toFilterOut = new _Set();
|
|
|
|
for (var i = 0; i < secondLen; i += 1) {
|
|
toFilterOut.add(second[i]);
|
|
}
|
|
|
|
while (idx < firstLen) {
|
|
if (toFilterOut.add(first[idx])) {
|
|
out[out.length] = first[idx];
|
|
}
|
|
idx += 1;
|
|
}
|
|
return out;
|
|
});
|
|
export default difference; |