Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

memoize-strict

jshanson74MIT0.0.4

Strict multi-argument memoization

memoize, strict, equality, arguments

readme

memoize-strict NPM version

Memoization with multi-argument support. Compares arguments with strict equality.

import memoize from 'memoize-strict';

let counter = 0;
const memoizeTest = memoize((a, b) => {
  counter++;
  return typeof a + ' ' + typeof b;
});

memoizeTest(1, true); // => "number boolean"
counter; // => "1"
memoizeTest(1, true); // => "number boolean"
counter; // => "1"

const a = {a: 'a'};
const b = ['b'];
memoizeTest(a, b); // => "object object"
counter; // => "2"
memoizeTest(a, b); // => "object object"
counter; // => "2"

memoizeTest({a: 'a'}, ['b']); // => "object object"
counter; // => "3"
memoizeTest({a: 'a'}, ['b']); // => "object object"
counter; // => "4"

Installation

npm i memoize-strict --save

License

MIT