From e9cb2965e9ba1a8c0d95475091f1aa21fd54c263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20H=C3=B6rl?= Date: Wed, 26 Jun 2013 23:46:15 +0200 Subject: [PATCH] Bugfix: safe call of .hasOwnProperty(...) --- lib/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 6bd6838d..5f1cea07 100644 --- a/lib/index.js +++ b/lib/index.js @@ -52,7 +52,8 @@ PG.prototype.cancel = function(config, client, query) { cancellingClient.cancel(client, query); }; -if (process.env.hasOwnProperty('NODE_PG_FORCE_NATIVE')) { +var forceNative = Object.prototype.hasOwnProperty.call(process.env, 'NODE_PG_FORCE_NATIVE'); +if (forceNative) { module.exports = new PG(require(__dirname + '/native')); } else { module.exports = new PG(Client);