Skip to content

Commit 65d1eec

Browse files
committed
Merge pull request #1860 from megawac/memoize-lu
Only coerce address to a string once
2 parents ad70083 + a99f6ee commit 65d1eec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

underscore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@
698698
_.memoize = function(func, hasher) {
699699
var memoize = function(key) {
700700
var cache = memoize.cache;
701-
var address = hasher ? hasher.apply(this, arguments) : key;
701+
var address = '' + (hasher ? hasher.apply(this, arguments) : key);
702702
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
703703
return cache[address];
704704
};

0 commit comments

Comments
 (0)