Skip to content

Shallow compare function arguments for memoization.

Notifications You must be signed in to change notification settings

vaukalak/shallowMemoize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShallowMemoize

Shallow compare function arguments for memoization. Useful when dealing with immutable data.

Example

let fetchFoo = memoize(function(objA, objB) { doHeavyThings(); return [objA.foo, objB.foo]; });

let a = { foo: 'a' }; let b = { foo: 'b' };

fetchFoo(a, b); // first call, no cache. fetchFoo(a, b); // second call, cache hit.

fetchFoo({ foo: 'c' }, { foo: 'd' }); // no cache fetchFoo({ foo: 'c' }, { foo: 'd' }); // no cache

About

Shallow compare function arguments for memoization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%