Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "memoizej"

Index

Functions

Functions

memoizeJ

  • memoizeJ<A, B>(fn: Fn<A, B>, cache?: IObjectOf<B>): Fn<A, B>
  • memoizeJ<A, B, C>(fn: Fn2<A, B, C>, cache?: IObjectOf<C>): Fn2<A, B, C>
  • memoizeJ<A, B, C, D>(fn: Fn3<A, B, C, D>, cache?: IObjectOf<D>): Fn3<A, B, C, D>
  • memoizeJ<A, B, C, D, E>(fn: Fn4<A, B, C, D, E>, cache?: IObjectOf<E>): Fn4<A, B, C, D, E>
  • Function memoization for arbitrary argument counts. Returns augmented function, which uses JSON.stringify() to obtain (and store) memoized result for given args. Supports generics for up to 4 args (otherwise untyped).

    Important: If the given args cannot be stringified, the user function will ALWAYS be called (without caching result).

    Type parameters

    • A

    • B

    Parameters

    • fn: Fn<A, B>

      -

    • Optional cache: IObjectOf<B>

      -

    Returns Fn<A, B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    • fn: Fn2<A, B, C>
    • Optional cache: IObjectOf<C>

    Returns Fn2<A, B, C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • fn: Fn3<A, B, C, D>
    • Optional cache: IObjectOf<D>

    Returns Fn3<A, B, C, D>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • fn: Fn4<A, B, C, D, E>
    • Optional cache: IObjectOf<E>

    Returns Fn4<A, B, C, D, E>

Generated using TypeDoc