Function bind

  • Bounds the given context to the given method.

    Example

    const bindConsole = bind(console);
    const log = bindConsole(console.log);

    log("Hello world!"); // Logs "Hello world!" without context errors.

    Returns

    Curried function with context in context.

    Type Parameters

    • Context

    Parameters

    • context: Context

    Returns (<Method>(method: Method) => Method)

      • <Method>(method: Method): Method
      • Type Parameters

        • Method extends GenericFunction<ReadOnlyArray<never>, unknown>

        Parameters

        • method: Method

        Returns Method