fx-flow v0.7.0 / pipe/strict / tap
Function: tap()
tap(fn, args)
tap<
A
,R
>(fn
,args
):A
extendsPromise
<unknown
> ?FixedPromise
<A
> :A
Invokes an interceptor and return the original value.
Type parameters
• A
• R
Parameters
• fn
• args: A
Returns
A
extends Promise
<unknown
> ? FixedPromise
<A
> : A
Example
typescript
const res = tap(console.log, { a: 'a' })
// log {a: 'a'}
// res = {a: 'a'}
const res2 = tap((v) => {v.a = 'b'}, { a: 'a' })
// res2 = {a: 'b'}
Source
packages/core/src/pipe/strict/tap.ts:18
tap(fn)
tap<
A
,R
>(fn
): (args
) =>A
extendsPromise
<unknown
> ?FixedPromise
<A
> :A
Type parameters
• A
• R
Parameters
• fn
Returns
Function
Parameters
• args: A
Returns
A
extends Promise
<unknown
> ? FixedPromise
<A
> : A