Returns a new function to use in place of func that will call the provided hooks in addition to func. They are called in the following order:
func
before
around
original
transform
after
const sum = (a: number, b: number) => a + b;const sumAndLog = wrapFunction(sum, { after: (result, a, b) => { console.log(a, '+', b, '=', result); },}const sumPlusOne = wrapFunction(sum, { transform: (result) => result + 1,}); Copy
const sum = (a: number, b: number) => a + b;const sumAndLog = wrapFunction(sum, { after: (result, a, b) => { console.log(a, '+', b, '=', result); },}const sumPlusOne = wrapFunction(sum, { transform: (result) => result + 1,});
Returns a new function to use in place of
functhat will call the provided hooks in addition tofunc. They are called in the following order:beforearoundif provided, elseoriginaltransformafter