UNPKG

875 BJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4
5var _dispatchable =
6/*#__PURE__*/
7require("./internal/_dispatchable");
8
9var _xtap =
10/*#__PURE__*/
11require("./internal/_xtap");
12/**
13 * Runs the given function with the supplied object, then returns the object.
14 *
15 * Acts as a transducer if a transformer is given as second parameter.
16 *
17 * @func
18 * @memberOf R
19 * @since v0.1.0
20 * @category Function
21 * @sig (a -> *) -> a -> a
22 * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.
23 * @param {*} x
24 * @return {*} `x`.
25 * @example
26 *
27 * const sayX = x => console.log('x is ' + x);
28 * R.tap(sayX, 100); //=> 100
29 * // logs 'x is 100'
30 * @symb R.tap(f, a) = a
31 */
32
33
34var tap =
35/*#__PURE__*/
36_curry2(
37/*#__PURE__*/
38_dispatchable([], _xtap, function tap(fn, x) {
39 fn(x);
40 return x;
41}));
42
43module.exports = tap;
\No newline at end of file