Function asAsync

  • Keeps sure to returns an async function.

    Example

    const func1 = asAsync((a: number, b: number) => a + b)
    const func2 = asAsync(async (x: string, y: number) => x + y)

    const sum1 = await func1(5979, 23979) // 29958
    const sum2 = await func2('TM', 5979) // 'TM5979'

    Returns

    The result with the async function.

    Type Parameters

    • TResult extends unknown = any

    Parameters

    • func: ((...args: any[]) => any)

      The input value.

        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns AsyncFunc<TResult>

Generated using TypeDoc