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:
892 bytes
|
Line | |
---|
1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 |
|
---|
5 | var _dispatchable =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./internal/_dispatchable.js");
|
---|
8 |
|
---|
9 | var _xtap =
|
---|
10 | /*#__PURE__*/
|
---|
11 | require("./internal/_xtap.js");
|
---|
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) = (f(a), a)
|
---|
31 | */
|
---|
32 |
|
---|
33 |
|
---|
34 | var tap =
|
---|
35 | /*#__PURE__*/
|
---|
36 | _curry2(
|
---|
37 | /*#__PURE__*/
|
---|
38 | _dispatchable([], _xtap, function tap(fn, x) {
|
---|
39 | fn(x);
|
---|
40 | return x;
|
---|
41 | }));
|
---|
42 |
|
---|
43 | module.exports = tap; |
---|
Note:
See
TracBrowser
for help on using the repository browser.