From 025562cc143728e3b1d0850e0e917cb52e00281a Mon Sep 17 00:00:00 2001 From: nagman Date: Thu, 26 Jul 2018 15:59:31 +0200 Subject: [PATCH 1/3] Changed toString() to Object.prototype.toString() Strangely enough, the .toString() method fires an error in nodejs when the value comes directly from a object transformed by the graphql-yoga package. Had to replace it with Object.prototype.toString() and now it works. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 87043aa..7a7bcc8 100755 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ * @return {Boolean} */ function isObject(value) { - return value && value.toString() === '[object Object]'; + return value && Object.prototype.toString(value) === '[object Object]'; } /** From 3ad58a2aa09677e6b12286b1b1d7e74101170cd8 Mon Sep 17 00:00:00 2001 From: Alex Kheben Date: Thu, 26 Jul 2018 18:21:25 +0300 Subject: [PATCH 2/3] Update index.js That's better. --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7a7bcc8..9efae24 100755 --- a/index.js +++ b/index.js @@ -1,9 +1,11 @@ +const toString = Object.prototype.toString; + /** * @param {*} value Value * @return {Boolean} */ function isObject(value) { - return value && Object.prototype.toString(value) === '[object Object]'; + return toString(value) === '[object Object]'; } /** From 3b01f9ec8d169934b397cf49f9a293c92a1a638f Mon Sep 17 00:00:00 2001 From: Alex Kheben Date: Thu, 26 Jul 2018 18:27:16 +0300 Subject: [PATCH 3/3] Update index.js That's better :) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9efae24..779c788 100755 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ const toString = Object.prototype.toString; * @return {Boolean} */ function isObject(value) { - return toString(value) === '[object Object]'; + return toString.call(value) === '[object Object]'; } /**