Skip to main content

tap()

tap<T, R>(fn): (val) => T

Calls the given function with the passed value and returns the value unchanged.

Type Parameters

T

T

The type of the input given to the function.

R

R

The return type of the given function.

Parameters

fn

(v) => R

The function to call, passing the given value.

Returns

(val): T

Parameters

val

T

Returns

T

Remarks

tap :: (a -> b) -> a -> a

Example

tap(console.log)('foobar');
// foobar