1.0.3 • Published 6 months ago

@sweetacid/saw v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months 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

6 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago