Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "memoize"

Index

Functions

Functions

memoize

  • memoize<A, B>(fn: Fn1<A, B>, cache: MapLike<A, B>): Fn1<A, B>
  • memoize<A, B, C>(fn: Fn2<A, B, C>, cache: MapLike<[A, B], C>): Fn2<A, B, C>
  • memoize<A, B, C, D>(fn: Fn3<A, B, C, D>, cache: MapLike<[A, B, C], D>): Fn3<A, B, C, D>
  • memoize<A, B, C, D, E>(fn: Fn4<A, B, C, D, E>, cache: MapLike<[A, B, C, D], E>): Fn4<A, B, C, D, E>
  • Function memoization for arbitrary argument counts. Returns augmented function, which uses the given Map implementation to obtain and store memoized result of given args. Supports generics for up to 4 args (otherwise untyped).

    Important: It only makes sense to use Map types which support value (rather than object) equality, e.g. those provided by thi.ng/associative. Using a native Map type here will lead to memory leaks! Alternatively, use memoizeJ.

    Type parameters

    • A

    • B

    Parameters

    Returns Fn1<A, B>

  • Type parameters

    • A

    • B

    • C

    Parameters

    Returns Fn2<A, B, C>

  • Type parameters

    • A

    • B

    • C

    • D

    Parameters

    • fn: Fn3<A, B, C, D>
    • cache: MapLike<[A, B, C], D>

    Returns Fn3<A, B, C, D>

  • Type parameters

    • A

    • B

    • C

    • D

    • E

    Parameters

    • fn: Fn4<A, B, C, D, E>
    • cache: MapLike<[A, B, C, D], E>

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

Generated using TypeDoc