summaryrefslogtreecommitdiff
path: root/lib/memoize.js
diff options
context:
space:
mode:
authorAlexander Early <alexander.early@gmail.com>2016-02-14 15:54:59 -0800
committerAlexander Early <alexander.early@gmail.com>2016-02-14 15:54:59 -0800
commite46c8a6c74035223eecd55ba6dfdbef0e34cefad (patch)
tree4d9a7140c8e97261b2fa8ef9c4c9ae690a85136b /lib/memoize.js
parentdb9acac2bb7161fac1d9c83fbce416ef63b95420 (diff)
parent01205e053b16c7843a3d4d3c9075b33de5adb2d0 (diff)
downloadasync-e46c8a6c74035223eecd55ba6dfdbef0e34cefad.tar.gz
merge from master
Diffstat (limited to 'lib/memoize.js')
-rw-r--r--lib/memoize.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/memoize.js b/lib/memoize.js
index 59c8ae3..963e031 100644
--- a/lib/memoize.js
+++ b/lib/memoize.js
@@ -2,6 +2,7 @@
import identity from 'lodash/identity';
import rest from 'lodash/rest';
+import has from 'lodash/has';
import setImmediate from './internal/setImmediate';
@@ -12,11 +13,11 @@ export default function memoize(fn, hasher) {
var memoized = rest(function memoized(args) {
var callback = args.pop();
var key = hasher.apply(null, args);
- if (key in memo) {
+ if (has(memo, key)) {
setImmediate(function() {
callback.apply(null, memo[key]);
});
- } else if (key in queues) {
+ } else if (has(queues, key)) {
queues[key].push(callback);
} else {
queues[key] = [callback];