source: node_modules/ramda/es/without.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 946 bytes
Line 
1import _curry2 from "./internal/_curry2.js";
2import _Set from "./internal/_Set.js";
3import reject from "./reject.js";
4/**
5 * Returns a new list without values in the first argument.
6 * [`R.equals`](#equals) is used to determine equality.
7 *
8 * Acts as a transducer if a transformer is given in list position.
9 *
10 * @func
11 * @memberOf R
12 * @since v0.19.0
13 * @category List
14 * @sig [a] -> [a] -> [a]
15 * @param {Array} list1 The values to be removed from `list2`.
16 * @param {Array} list2 The array to remove values from.
17 * @return {Array} The new array without values in `list1`.
18 * @see R.transduce, R.difference, R.remove
19 * @example
20 *
21 * R.without([1, 2], [1, 2, 1, 3, 4]); //=> [3, 4]
22 */
23
24var without =
25/*#__PURE__*/
26_curry2(function without(xs, list) {
27 var toRemove = new _Set();
28
29 for (var i = 0; i < xs.length; i += 1) {
30 toRemove.add(xs[i]);
31 }
32
33 return reject(toRemove.has.bind(toRemove), list);
34});
35
36export default without;
Note: See TracBrowser for help on using the repository browser.