Function toPromise

  • Converts a callback into a promise. Assumes last parameter is the callback

    Parameters

    • fn: ((...fnArgs) => unknown)
        • (...fnArgs): unknown
        • Parameters

          • Rest ...fnArgs: unknown[]

          Returns unknown

    Returns ((...args) => Promise<unknown>)

      • (...args): Promise<unknown>
      • Parameters

        • Rest ...args: unknown[]

        Returns Promise<unknown>

    Todo

    Look at changing resolve value from cbArgs[0] to include other callback arguments?

Generated using TypeDoc