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