update
This commit is contained in:
parent
d9becc67b6
commit
9308795b8b
964 changed files with 104265 additions and 16 deletions
55
node_modules/ramda/src/intersection.js
generated
vendored
Normal file
55
node_modules/ramda/src/intersection.js
generated
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
var _includes =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_includes");
|
||||
|
||||
var _curry2 =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_curry2");
|
||||
|
||||
var _filter =
|
||||
/*#__PURE__*/
|
||||
require("./internal/_filter");
|
||||
|
||||
var flip =
|
||||
/*#__PURE__*/
|
||||
require("./flip");
|
||||
|
||||
var uniq =
|
||||
/*#__PURE__*/
|
||||
require("./uniq");
|
||||
/**
|
||||
* Combines two lists into a set (i.e. no duplicates) composed of those
|
||||
* elements common to both lists.
|
||||
*
|
||||
* @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 list of elements found in both `list1` and `list2`.
|
||||
* @see R.innerJoin
|
||||
* @example
|
||||
*
|
||||
* R.intersection([1,2,3,4], [7,6,5,4,3]); //=> [4, 3]
|
||||
*/
|
||||
|
||||
|
||||
var intersection =
|
||||
/*#__PURE__*/
|
||||
_curry2(function intersection(list1, list2) {
|
||||
var lookupList, filteredList;
|
||||
|
||||
if (list1.length > list2.length) {
|
||||
lookupList = list1;
|
||||
filteredList = list2;
|
||||
} else {
|
||||
lookupList = list2;
|
||||
filteredList = list1;
|
||||
}
|
||||
|
||||
return uniq(_filter(flip(_includes)(lookupList), filteredList));
|
||||
});
|
||||
|
||||
module.exports = intersection;
|
Loading…
Add table
Add a link
Reference in a new issue