From a8fd7fe0051ed3f08119a65d24e50444facdb622 Mon Sep 17 00:00:00 2001 From: Tor Hagemann Date: Mon, 18 Jul 2016 11:07:03 -0400 Subject: [PATCH 1/2] isObject: use typeof instead of .constructor --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index aacf6ef..8efd27a 100644 --- a/index.js +++ b/index.js @@ -235,5 +235,5 @@ function isGeneratorFunction(obj) { */ function isObject(val) { - return Object == val.constructor; + return 'object' == typeof val; } From 6309a8d43088661657bef49b9a7f941428ce7548 Mon Sep 17 00:00:00 2001 From: Tor Hagemann Date: Mon, 18 Jul 2016 12:33:16 -0400 Subject: [PATCH 2/2] Closes #281: use alternate method in isObject fixed `'object' == typeof null`; caught by tests --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8efd27a..725692b 100644 --- a/index.js +++ b/index.js @@ -235,5 +235,5 @@ function isGeneratorFunction(obj) { */ function isObject(val) { - return 'object' == typeof val; + return (null !== val) && ('object' == typeof val); }