1.0.1 • Published 4 years ago

@aya_ab/memoize v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Memoizer

This repository is a basic Memoizer implementation.

Memoization is best technique to save on memory or CPU cycles when we deal with repeated operations.

Basically, if the function is called with the same inputs, Memoizer helps directly return the result in the cache.

Here, i use a popular npm package memoizee.

Install

npm i @aya_ab/memoize
yarn add @aya_ab/memoize

Example

import { memoize } from "./memoize";
...
class MyClass {
  @memoize()
  myFunction(a = undefined, b = undefined, c = undefined) {
    var result = a + " " + b + " " + c;
    this.helloFunc();
    return result;
  }
  helloFunc() {}
}
...

Test

npm run test