Bugfix: safe call of .hasOwnProperty(...)

This commit is contained in:
Hannes Hörl 2013-06-26 23:46:15 +02:00
parent c126ba1c7c
commit e9cb2965e9

View File

@ -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);