1.0.3 • Published 2 years ago

@sweetacid/saw v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

saw

sync/async function wrapper

usage

const doSomething = () => console.log("zzZ..");
const doSomethingAsync = async () => console.log("...zzZ");
const doSomethingWith = (value: number) => console.log(value);
const throwSomething = () => {
    throw new Error("ZZZ");
};

const example = async () => {
    await saw(doSomething);

    await saw(doSomethingAsync);

    await saw(() => doSomethingWith(69));

    const [error] = await saw(throwSomething);
    if (error) {
        console.log("something bad happened");
    }
};
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago