(key)
| 28607 | // Memoize an expensive function by storing its results. |
| 28608 | _.memoize = function(func, hasher) { |
| 28609 | var memoize = function(key) { |
| 28610 | var cache = memoize.cache; |
| 28611 | var address = '' + (hasher ? hasher.apply(this, arguments) : key); |
| 28612 | if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); |
| 28613 | return cache[address]; |
| 28614 | }; |
| 28615 | memoize.cache = {}; |
| 28616 | return memoize; |
| 28617 | }; |