35 lines
917 B
JavaScript
35 lines
917 B
JavaScript
import _complement from "./internal/_complement.js";
|
|
import _curry2 from "./internal/_curry2.js";
|
|
import filter from "./filter.js";
|
|
/**
|
|
* The complement of [`filter`](#filter).
|
|
*
|
|
* Acts as a transducer if a transformer is given in list position. Filterable
|
|
* objects include plain objects or any object that has a filter method such
|
|
* as `Array`.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.0
|
|
* @category List
|
|
* @sig Filterable f => (a -> Boolean) -> f a -> f a
|
|
* @param {Function} pred
|
|
* @param {Array} filterable
|
|
* @return {Array}
|
|
* @see R.filter, R.transduce, R.addIndex
|
|
* @example
|
|
*
|
|
* const isOdd = (n) => n % 2 === 1;
|
|
*
|
|
* R.reject(isOdd, [1, 2, 3, 4]); //=> [2, 4]
|
|
*
|
|
* R.reject(isOdd, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}
|
|
*/
|
|
|
|
var reject =
|
|
/*#__PURE__*/
|
|
_curry2(function reject(pred, filterable) {
|
|
return filter(_complement(pred), filterable);
|
|
});
|
|
|
|
export default reject; |