mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 05:01:42 +03:00
37 lines
972 B
TypeScript
37 lines
972 B
TypeScript
|
// Loaded from https://deno.land/x/ramda@v0.27.2/source/reject.js
|
||
|
|
||
|
|
||
|
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 = _curry2(function reject(pred, filterable) {
|
||
|
return filter(_complement(pred), filterable);
|
||
|
});
|
||
|
export default reject;
|