mirror of
https://github.com/swc-project/swc.git
synced 2024-12-26 15:12:08 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/composeWith.js
|
|
|
|
|
|
import _curry2 from './internal/_curry2.js';
|
|
import pipeWith from './pipeWith.js';
|
|
import reverse from './reverse.js';
|
|
|
|
|
|
/**
|
|
* Performs right-to-left function composition using transforming function. The last function may have
|
|
* any arity; the remaining functions must be unary.
|
|
*
|
|
* **Note:** The result of composeWith is not automatically curried. Transforming function is not used
|
|
* on the last argument.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.26.0
|
|
* @category Function
|
|
* @sig ((* -> *), [(y -> z), (x -> y), ..., (o -> p), ((a, b, ..., n) -> o)]) -> ((a, b, ..., n) -> z)
|
|
* @param {Function} transformer The transforming function
|
|
* @param {Array} functions The functions to compose
|
|
* @return {Function}
|
|
* @see R.compose, R.pipeWith
|
|
* @example
|
|
*
|
|
* const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res));
|
|
*
|
|
* composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2
|
|
* composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined
|
|
*
|
|
* @symb R.composeWith(f)([g, h, i])(...args) = f(g, f(h, i(...args)))
|
|
*/
|
|
var composeWith = _curry2(function composeWith(xf, list) {
|
|
return pipeWith.apply(this, [xf, reverse(list)]);
|
|
});
|
|
export default composeWith;
|