source: frontend/node_modules/underscore/modules/memoize.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 419 bytes
Line 
1import has from './_has.js';
2
3// Memoize an expensive function by storing its results.
4export default function memoize(func, hasher) {
5 var memoize = function(key) {
6 var cache = memoize.cache;
7 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
8 if (!has(cache, address)) cache[address] = func.apply(this, arguments);
9 return cache[address];
10 };
11 memoize.cache = {};
12 return memoize;
13}
Note: See TracBrowser for help on using the repository browser.