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