1 | var _curry3 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry3.js");
|
---|
4 |
|
---|
5 | var _dispatchable =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./internal/_dispatchable.js");
|
---|
8 |
|
---|
9 | var _promap =
|
---|
10 | /*#__PURE__*/
|
---|
11 | require("./internal/_promap.js");
|
---|
12 |
|
---|
13 | var _xpromap =
|
---|
14 | /*#__PURE__*/
|
---|
15 | require("./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 |
|
---|
47 | var promap =
|
---|
48 | /*#__PURE__*/
|
---|
49 | _curry3(
|
---|
50 | /*#__PURE__*/
|
---|
51 | _dispatchable(['fantasy-land/promap', 'promap'], _xpromap, _promap));
|
---|
52 |
|
---|
53 | module.exports = promap; |
---|