mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/partition.js
|
|
|
|
|
|
import filter from './filter.js';
|
|
import juxt from './juxt.js';
|
|
import reject from './reject.js';
|
|
|
|
|
|
/**
|
|
* Takes a predicate and a list or other `Filterable` object and returns the
|
|
* pair of filterable objects of the same type of elements which do and do not
|
|
* satisfy, the predicate, respectively. Filterable objects include plain objects or any object
|
|
* that has a filter method such as `Array`.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.1.4
|
|
* @category List
|
|
* @sig Filterable f => (a -> Boolean) -> f a -> [f a, f a]
|
|
* @param {Function} pred A predicate to determine which side the element belongs to.
|
|
* @param {Array} filterable the list (or other filterable) to partition.
|
|
* @return {Array} An array, containing first the subset of elements that satisfy the
|
|
* predicate, and second the subset of elements that do not satisfy.
|
|
* @see R.filter, R.reject
|
|
* @example
|
|
*
|
|
* R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']);
|
|
* // => [ [ 'sss', 'bars' ], [ 'ttt', 'foo' ] ]
|
|
*
|
|
* R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
|
|
* // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' } ]
|
|
*/
|
|
var partition = juxt([filter, reject]);
|
|
export default partition;
|