Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ if(typeof process.env.NODE_PG_FORCE_NATIVE != 'undefined') {
module.exports = new PG(Client);

//lazy require native module...the native module may not have installed
module.exports.__defineGetter__("native", function() {
delete module.exports.native;
module.exports.native = new PG(require('./native'));
return module.exports.native;
Object.defineProperty(module.exports, 'native', {
get: function () {
delete module.exports._native;
module.exports._native = new PG(require('./native'));
return module.exports._native;
},
enumerable: false
});
}
7 changes: 7 additions & 0 deletions test/unit/client/native-property-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var helper = require(__dirname + "/test-helper");
var client = require(__dirname + "/../../../lib");

test('native property is non-enumerable', function() {
assert.equal(Object.keys(client).indexOf('native'), -1);
});