Ensure resolver provided to _.memoize is a function if it's truthy.

This commit is contained in:
John-David Dalton
2014-04-14 21:33:45 -07:00
parent 5c07dd995e
commit ff25b4cb46
3 changed files with 23 additions and 16 deletions

View File

@@ -3460,7 +3460,7 @@
* // => { 'name': 'penelope', 'age': 1 }
*/
function memoize(func, resolver) {
if (!isFunction(func)) {
if (!isFunction(func) || (resolver && !isFunction(resolver))) {
throw new TypeError;
}
var cache = {};