Returns a function decorating an original function with a callback, which will be invoked after the execution of the original function. The return value of the original function will be handed over to the after callback as an argument, while the return value of the callback will become the overall result.
npm install @dizmo/functions-after --save
const { after } = require("@dizmo/functions-after");
import { after } from "@dizmo/functions-after";
const f1 = (): number => {
return 1;
};
const f2 = after(f1, (n: number): number => {
return n + 1;
});
const expect = 2 === f2();
class Class {
@after.decorator((n: number): number => {
return n + 1;
})
public method(): number {
return 1;
}
}
const expect = 2 === new Class().method();
npm run clean
npm run build
npm run -- build --no-lint --no-clean
npm run -- build --prepack
npm run -- build --prepack --no-minify
npm run lint
npm run -- lint --fix
npm run test
npm run -- test --no-lint --no-clean --no-build
npm run cover
npm run -- cover --no-lint --no-clean --no-build
npm run docs
npm publish
npm publish --access=public
© 2020 dizmo AG, Switzerland