Skip to main content
Module

x/ramda/reject.js

:ram: Practical functional Javascript
Very Popular
Go to Latest
File
import _complement from './internal/_complement';import _curry2 from './internal/_curry2';import filter from './filter';

/** * 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 = _curry2(function reject(pred, filterable) { return filter(_complement(pred), filterable);});export default reject;