1.0.3 • Published 1 year ago

@j4ndrw/defer v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Defer

A package that allows you to defer the execution of a particular instruction at the end of the function's execution.

Example usage

import { deferred } from '@j4ndrw/defer';

const file = ...; // imagine this is a file object with read, write, open and close methods

async function main() {
    const content = await deferred(async ({ defer }) => {
        await file.open();
        defer(async () => file.close());

        file.write("This is some text");
        return file.read();
    })
}

main();
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago