Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / helpers / tap

Function: tap()

tap<T>(value, callback): T

Defined in: helpers/index.ts:149

Pass a value to a callback and return the original value. Great for side-effects (logging, events) in the middle of a chain.

Type Parameters

T

T

Parameters

value

T

callback

(val) => void

Returns

T

Example

return tap(await User.create(data), (user) => Events.emit(new UserRegistered(user.id)));