Make _.memoize avoid using keyPrefix if passed a resolver function. [closes #330]

Former-commit-id: 97e3bb353d988c92eea394dfb496ebf7594ae25f
This commit is contained in:
John-David Dalton
2013-08-19 22:42:15 -07:00
parent 1901134601
commit a562126f2f
8 changed files with 103 additions and 33 deletions

View File

@@ -2405,13 +2405,13 @@
(function() {
test('should expose a `cache` object on the `memoized` function', function() {
var memoized = _.memoize(_.identity);
var memoized = _.memoize(_.identity, _.identity);
memoized('x');
equal(memoized.cache.x, 'x');
var cache = memoized.cache,
key = _.keys(cache)[0];
equal(cache[key], 'x');
memoized.cache.x = 'y';
equal(memoized('x'), 'y');
});
}());