Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
node: env flag to expose internals
  • Loading branch information
vkurchatkin committed Mar 25, 2015
commit 57d0df50c6b62db292297d562f91fda18dee78de
21 changes: 15 additions & 6 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,13 +838,22 @@
return NativeModule._source.hasOwnProperty(id);
};

NativeModule.nonInternalExists = function(id) {
return NativeModule.exists(id) && !NativeModule.isInternal(id);
};
if (process.env['NODE_EXPOSE_INTERNALS']) {
NativeModule.nonInternalExists = NativeModule.exists;

NativeModule.isInternal = function(id) {
return false;
};
} else {
NativeModule.nonInternalExists = function(id) {
return NativeModule.exists(id) && !NativeModule.isInternal(id);
};

NativeModule.isInternal = function(id) {
return id.startsWith('internal/');
};
}

NativeModule.isInternal = function(id) {
return id.startsWith('internal/');
};

NativeModule.getSource = function(id) {
return NativeModule._source[id];
Expand Down