Function unpackPromise

  • Parameters

    • thenable: any

    Returns {
        catch: any;
        finally: any;
        then: any;
    }

    • catch: any
    • finally: any
    • then: any

    Stability

    4 - locked

    Obtains and splits a promise into its individual then, catch, and finally components, already bound and ready to be destructured.

    The given object is forced to be a promise using Promise.resolve.

    Example

    const { then, catch, finally } = unpack_promise(Promise.resolve(27));

    then(console.log); // 27

Generated using TypeDoc