source: frontend/node_modules/underscore/amd/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: 459 bytes
Line 
1define(['./_has'], function (_has) {
2
3 // Memoize an expensive function by storing its results.
4 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 }
14
15 return memoize;
16
17});
Note: See TracBrowser for help on using the repository browser.