JSPM

memoize-resolver

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 40527
  • Score
    100M100P100Q158291F
  • License MIT

A general purpose key resolver for memoize

Package Exports

  • memoize-resolver

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (memoize-resolver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

memoize-resolver

What is it?

memoize-resolver is a general purpose key resolver for use with a memoize implementation like the one in Lodash.

Why might you need it?

When you memoize a function that receives multiple argments, by default only the first argument is used as the cache key.

The key resolver implemented in memoize-resolver will create a key that's generated from all of the arguments received by the memoized function.

Install

Install the package using NPM:

npm install memoize-resolver --save

And import the function for use with TypeScript or ES2015:

import { createResolver } from "memoize-resolver";

Usage

const work = (state, props) => { /* something expensive */ };
const resolver = createResolver();
const memoizedWork = _.memoize(work, resolver);