Function thunk

  • Delayed evaluation function.

    Example

    const always = thunk(id);
    const alwaysFoo = always("foo")
    alwaysFoo(); // "foo"

    Returns

    Function that will run the given function when called.

    Type Parameters

    • Input

    • Output

    Parameters

    • unary: Unary<Input, Output>

    Returns ((input: Input) => (() => Output))

      • (input: Input): (() => Output)
      • Parameters

        • input: Input

        Returns (() => Output)

          • (): Output
          • Returns Output