1.0.22 • Published 1 year ago

@dizmo/functions-after v1.0.22

Weekly downloads
1
License
ISC
Repository
github
Last release
1 year ago

NPM version Build Status Coverage Status

@dizmo/functions-after

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.

Usage

Install

npm install @dizmo/functions-after --save

Require

const { after } = require("@dizmo/functions-after");

Examples

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();

Development

Clean

npm run clean

Build

npm run build

without linting and cleaning:

npm run -- build --no-lint --no-clean

with UMD bundling (incl. minimization):

npm run -- build --prepack

with UMD bundling (excl. minimization):

npm run -- build --prepack --no-minify

Lint

npm run lint

with auto-fixing:

npm run -- lint --fix

Test

npm run test

without linting, cleaning and (re-)building:

npm run -- test --no-lint --no-clean --no-build

Cover

npm run cover

without linting, cleaning and (re-)building:

npm run -- cover --no-lint --no-clean --no-build

Documentation

npm run docs

Publish

npm publish

initially (if public):

npm publish --access=public

Copyright

© 2020 dizmo AG, Switzerland

1.0.22

1 year ago

1.0.20

3 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago