source: node_modules/ramda/es/promap.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[d24f17c]1import _curry3 from "./internal/_curry3.js";
2import _dispatchable from "./internal/_dispatchable.js";
3import _promap from "./internal/_promap.js";
4import _xpromap from "./internal/_xpromap.js";
5/**
6 * Takes two functions as pre- and post- processors respectively for a third function,
7 * i.e. `promap(f, g, h)(x) === g(h(f(x)))`.
8 *
9 * Dispatches to the `promap` method of the third argument, if present,
10 * according to the [FantasyLand Profunctor spec](https://github.com/fantasyland/fantasy-land#profunctor).
11 *
12 * Acts as a transducer if a transformer is given in profunctor position.
13 *
14 * @func
15 * @memberOf R
16 * @since v0.28.0
17 * @category Function
18 * @sig (a -> b) -> (c -> d) -> (b -> c) -> (a -> d)
19 * @sig Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d
20 * @param {Function} f The preprocessor function, a -> b
21 * @param {Function} g The postprocessor function, c -> d
22 * @param {Profunctor} profunctor The profunctor instance to be promapped, e.g. b -> c
23 * @return {Profunctor} The new profunctor instance, e.g. a -> d
24 * @see R.transduce
25 * @example
26 *
27 * const decodeChar = R.promap(s => s.charCodeAt(), String.fromCharCode, R.add(-8))
28 * const decodeString = R.promap(R.split(''), R.join(''), R.map(decodeChar))
29 * decodeString("ziuli") //=> "ramda"
30 *
31 * @symb R.promap(f, g, h) = x => g(h(f(x)))
32 * @symb R.promap(f, g, profunctor) = profunctor.promap(f, g)
33 */
34
35var promap =
36/*#__PURE__*/
37_curry3(
38/*#__PURE__*/
39_dispatchable(['fantasy-land/promap', 'promap'], _xpromap, _promap));
40
41export default promap;
Note: See TracBrowser for help on using the repository browser.