memoize-strict
v0.0.4
Published
Strict multi-argument memoization
Downloads
3
Maintainers
Readme
memoize-strict
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