This package has been deprecated

    Author message:

    WARNING: This project has been renamed to '@await-of/of'. Install using '@await-of/of' instead.

    @r37r0m0d3l/of
    TypeScript icon, indicating that this package has built-in type declarations

    2.4.7 • Public • Published

    🍡🍭🍬 O F 🍡🍭🍬

    https://of.js.org/

    Syntactic sugar for asynchronous functions, promises, generators and synchronous functions.

    Deno version of module - 🍬🦕 DenOf 🍬🦕.

    NPM Version NPM Downloads GitHub Stars

    TypeScript Typings Travis CI

    Maintainability Rating LGTM Codacy Badge deepcode

    OF

    💬 Usage

    import { ofAnyCase } from "@r37r0m0d3l/of";
    const promise = () => new Promise((resolve, _reject) => {
      resolve({ data: true });
    });
    const config = {
      defaults: "🤷 Default value in case of error",
      error: new Error("💀 Custom error, replaces thrown error"),
      retries: 3, // 🔁 Third time's a charm
      timeout: 1000, // ⏱️ Delay before timeout error
    };
    // no error thrown
    const [result, error] = await ofAnyCase(promise(), config);
    console.log(result); // { data: true }
    console.warn(error); // no error thrown, so it's undefined

    🗺️ Discover more

    My other projects

    Install

    npm i @r37r0m0d3l/of

    Homepage

    of.js.org

    DownloadsWeekly Downloads

    1

    Version

    2.4.7

    License

    MIT

    Unpacked Size

    85.2 kB

    Total Files

    10

    Last publish

    Collaborators

    • r37r0m0d3l