Icard/angular-clarity-master(work.../node_modules/ramda/es/promap.js

41 lines
1.5 KiB
JavaScript

import _curry3 from "./internal/_curry3.js";
import _dispatchable from "./internal/_dispatchable.js";
import _promap from "./internal/_promap.js";
import _xpromap from "./internal/_xpromap.js";
/**
* Takes two functions as pre- and post- processors respectively for a third function,
* i.e. `promap(f, g, h)(x) === g(h(f(x)))`.
*
* Dispatches to the `promap` method of the third argument, if present,
* according to the [FantasyLand Profunctor spec](https://github.com/fantasyland/fantasy-land#profunctor).
*
* Acts as a transducer if a transformer is given in profunctor position.
*
* @func
* @memberOf R
* @since v0.28.0
* @category Function
* @sig (a -> b) -> (c -> d) -> (b -> c) -> (a -> d)
* @sig Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d
* @param {Function} f The preprocessor function, a -> b
* @param {Function} g The postprocessor function, c -> d
* @param {Profunctor} profunctor The profunctor instance to be promapped, e.g. b -> c
* @return {Profunctor} The new profunctor instance, e.g. a -> d
* @see R.transduce
* @example
*
* const decodeChar = R.promap(s => s.charCodeAt(), String.fromCharCode, R.add(-8))
* const decodeString = R.promap(R.split(''), R.join(''), R.map(decodeChar))
* decodeString("ziuli") //=> "ramda"
*
* @symb R.promap(f, g, h) = x => g(h(f(x)))
* @symb R.promap(f, g, profunctor) = profunctor.promap(f, g)
*/
var promap =
/*#__PURE__*/
_curry3(
/*#__PURE__*/
_dispatchable(['fantasy-land/promap', 'promap'], _xpromap, _promap));
export default promap;