swc/bundler/tests/.cache/deno/729b826f0ec6cd05ae4c56a66ff267f68d230551.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

36 lines
1.2 KiB
TypeScript

// Loaded from https://deno.land/x/ramda@v0.27.2/source/unionWith.js
import _concat from './internal/_concat.js';
import _curry3 from './internal/_curry3.js';
import uniqWith from './uniqWith.js';
/**
* Combines two lists into a set (i.e. no duplicates) composed of the elements
* of each list. Duplication is determined according to the value returned by
* applying the supplied predicate to two list elements. If an element exists
* in both lists, the first element from the first list will be used.
*
* @func
* @memberOf R
* @since v0.1.0
* @category Relation
* @sig ((a, a) -> Boolean) -> [*] -> [*] -> [*]
* @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 first and second lists concatenated, with
* duplicates removed.
* @see R.union
* @example
*
* const l1 = [{a: 1}, {a: 2}];
* const l2 = [{a: 1}, {a: 4}];
* R.unionWith(R.eqBy(R.prop('a')), l1, l2); //=> [{a: 1}, {a: 2}, {a: 4}]
*/
var unionWith = _curry3(function unionWith(pred, list1, list2) {
return uniqWith(pred, _concat(list1, list2));
});
export default unionWith;