Icard/angular-clarity-master(work.../node_modules/ramda/src/innerJoin.js

57 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-07-16 15:23:22 +00:00
var _includesWith =
/*#__PURE__*/
require("./internal/_includesWith.js");
var _curry3 =
/*#__PURE__*/
require("./internal/_curry3.js");
var _filter =
/*#__PURE__*/
require("./internal/_filter.js");
/**
* Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
* `xs'` comprising each of the elements of `xs` which is equal to one or more
* elements of `ys` according to `pred`.
*
* `pred` must be a binary function expecting an element from each list.
*
* `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should
* not be significant, but since `xs'` is ordered the implementation guarantees
* that its values are in the same order as they appear in `xs`. Duplicates are
* not removed, so `xs'` may contain duplicates if `xs` contains duplicates.
*
* @func
* @memberOf R
* @since v0.24.0
* @category Relation
* @sig ((a, b) -> Boolean) -> [a] -> [b] -> [a]
* @param {Function} pred
* @param {Array} xs
* @param {Array} ys
* @return {Array}
* @see R.intersection
* @example
*
* R.innerJoin(
* (record, id) => record.id === id,
* [{id: 824, name: 'Richie Furay'},
* {id: 956, name: 'Dewey Martin'},
* {id: 313, name: 'Bruce Palmer'},
* {id: 456, name: 'Stephen Stills'},
* {id: 177, name: 'Neil Young'}],
* [177, 456, 999]
* );
* //=> [{id: 456, name: 'Stephen Stills'}, {id: 177, name: 'Neil Young'}]
*/
var innerJoin =
/*#__PURE__*/
_curry3(function innerJoin(pred, xs, ys) {
return _filter(function (x) {
return _includesWith(pred, x, ys);
}, xs);
});
module.exports = innerJoin;