Function cached

  • Cache an arbitrary function of arity 0 or 1. May provide an optional Map<argType, returnType>, or one will be created.

    Type Parameters

    • R

    Parameters

    • fn: (() => R)
        • (): R
        • Returns R

    • Optional cache: MapLike<undefined, R>

    Returns (() => R) & {
        cache: Map<undefined, R>;
    }

  • Type Parameters

    • A

    • R

    Parameters

    • fn: ((arg) => R)
        • (arg): R
        • Parameters

          • arg: A

          Returns R

    • Optional cache: MapLike<A, R>

    Returns ((arg) => R) & {
        cache: Map<A, R>;
    }

Generated using TypeDoc