Skip to main content

Module: Side Effects

Functions

inject

inject<Function>(effect): (fn: Function) => Function

Injects a function with a side effect. Returns the copy of the original function.

Type parameters

NameType
Functionextends VariadicFunction

Parameters

NameType
effectEffect<Function>

Returns

fn

▸ (fn): Function

Parameters
NameType
fnFunction
Returns

Function

inject<Function>(fn, effect): Function

Injects a function with a side effect. Returns the copy of the original function.

Type parameters

NameType
Functionextends VariadicFunction

Parameters

NameType
fnFunction
effectEffect<Function>

Returns

Function


rethrow

rethrow<Error>(effect?): (error: Error) => never

Rethrows a received error performing an optional side effect.

Type parameters

Name
Error

Parameters

NameType
effect?Effect<(error: Error) => never>

Returns

fn

▸ (error): never

Parameters
NameType
errorError
Returns

never


tap

tap<Value>(effect): Identity<Value>

Performs a side effect passing the received argument through itself.

Type parameters

Name
Value

Parameters

NameType
effectEffect<Map<Value, any>>

Returns

Identity<Value>