apiref
ride@2.0.1

ride.compose()  Function

Transforms the return value of the original function.

Signature

function compose<T, R>(transformer: (this: T, value: R) => R): Decorator<T, (this: T, ...args: any[]) => R>;

Remarks

If the original function throws an error, the transformer function will NOT be called.

Example

ride(test, 'getName', ride.compose(name => name.toUpperCase()))

Parameters

ParameterTypeDescription
transformer(this: T, value: R) => R

The function that takes in the return value of the original function and returns a new return value.

(Returns)Decorator<T, (this: T, ...args: any[]) => R>