MCPcopy Index your code
hub / github.com/microsoft/SandDance / memoize

Function memoize

docs/app/js/sanddance-app.js:24032–24042  ·  view source on GitHub ↗
(target, key, descriptor)

Source from the content-addressed store, hash-verified

24030 _resetCounter++;
24031}
24032function memoize(target, key, descriptor) {
24033 // We bind to "null" to prevent people from inadvertently pulling values from "this",
24034 // rather than passing them in as input values which can be memoized.
24035 var fn = memoizeFunction(descriptor.value && descriptor.value.bind(null));
24036 return {
24037 configurable: true,
24038 get: function() {
24039 return fn;
24040 }
24041 };
24042}
24043function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) {
24044 if (maxCacheSize === void 0) maxCacheSize = 100;
24045 if (ignoreNullOrUndefinedResult === void 0) ignoreNullOrUndefinedResult = false;

Callers 2

numberLocaleFunction · 0.70
timeLocaleFunction · 0.70

Calls 3

memoizeFunctionFunction · 0.85
isEqualFunction · 0.70
methodFunction · 0.70

Tested by

no test coverage detected