source: node_modules/ramda/es/tap.js@ d24f17c

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

Initial commit

  • Property mode set to 100644
File size: 836 bytes
RevLine 
[d24f17c]1import _curry2 from "./internal/_curry2.js";
2import _dispatchable from "./internal/_dispatchable.js";
3import _xtap from "./internal/_xtap.js";
4/**
5 * Runs the given function with the supplied object, then returns the object.
6 *
7 * Acts as a transducer if a transformer is given as second parameter.
8 *
9 * @func
10 * @memberOf R
11 * @since v0.1.0
12 * @category Function
13 * @sig (a -> *) -> a -> a
14 * @param {Function} fn The function to call with `x`. The return value of `fn` will be thrown away.
15 * @param {*} x
16 * @return {*} `x`.
17 * @example
18 *
19 * const sayX = x => console.log('x is ' + x);
20 * R.tap(sayX, 100); //=> 100
21 * // logs 'x is 100'
22 * @symb R.tap(f, a) = (f(a), a)
23 */
24
25var tap =
26/*#__PURE__*/
27_curry2(
28/*#__PURE__*/
29_dispatchable([], _xtap, function tap(fn, x) {
30 fn(x);
31 return x;
32}));
33
34export default tap;
Note: See TracBrowser for help on using the repository browser.