tap()
tap<
T
,R
>(fn
): (val
) =>T
Calls the given function with the passed value and returns the value unchanged.
Type Parameters
• T
• R
Parameters
fn
(v
) => R
The function to call, passing the given value.
Returns
Function
Parameters
val
T
Returns
T
Remark
ap :: (a -> b) -> a -> a
Example
tap(console.log)('foobar');
// foobar