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:
917 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _complement from "./internal/_complement.js";
|
---|
| 2 | import _curry2 from "./internal/_curry2.js";
|
---|
| 3 | import filter from "./filter.js";
|
---|
| 4 | /**
|
---|
| 5 | * The complement of [`filter`](#filter).
|
---|
| 6 | *
|
---|
| 7 | * Acts as a transducer if a transformer is given in list position. Filterable
|
---|
| 8 | * objects include plain objects or any object that has a filter method such
|
---|
| 9 | * as `Array`.
|
---|
| 10 | *
|
---|
| 11 | * @func
|
---|
| 12 | * @memberOf R
|
---|
| 13 | * @since v0.1.0
|
---|
| 14 | * @category List
|
---|
| 15 | * @sig Filterable f => (a -> Boolean) -> f a -> f a
|
---|
| 16 | * @param {Function} pred
|
---|
| 17 | * @param {Array} filterable
|
---|
| 18 | * @return {Array}
|
---|
| 19 | * @see R.filter, R.transduce, R.addIndex
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * const isOdd = (n) => n % 2 !== 0;
|
---|
| 23 | *
|
---|
| 24 | * R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
|
---|
| 25 | *
|
---|
| 26 | * R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | var reject =
|
---|
| 30 | /*#__PURE__*/
|
---|
| 31 | _curry2(function reject(pred, filterable) {
|
---|
| 32 | return filter(_complement(pred), filterable);
|
---|
| 33 | });
|
---|
| 34 |
|
---|
| 35 | export default reject; |
---|
Note:
See
TracBrowser
for help on using the repository browser.