@code-workers.io/ts-memoize
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@code-workers.io/ts-memoize

Library providing memoization functionality via:

  • a memoize-function
  • a Memoize-decorator

Installation

npm i @code-workers.io/ts-memoize

Usage

Decorator Usage

Annotate the function you want to memoize using the Memoize-decorator:

class Test {
  @Memoize()
  calculate(a: number, b: number): number {
    return a + b;
  }
}

Function usage

Use the memoize-function:

class Test {
  calc(a: number, b: number): number {
    return memoize((a, b) => a + b).memoized(a, b);
  }
}

/@code-workers.io/ts-memoize/

    Package Sidebar

    Install

    npm i @code-workers.io/ts-memoize

    Weekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    8.04 kB

    Total Files

    8

    Last publish

    Collaborators

    • mikelgo