Skip to content

Commit 233d4f8

Browse files
committed
lib: remove variables root and GLOBAL
The `root` and `GLOBAL` never be documented.
1 parent 2c686fd commit 233d4f8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/node.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,17 @@
159159
startup.globalVariables = function() {
160160
global.process = process;
161161
global.global = global;
162-
global.GLOBAL = global;
163-
global.root = global;
162+
163+
// Deprecate GLOBAL and root
164+
const holders = {GLOBAL: global, root: global};
165+
['GLOBAL', 'root'].forEach(function (name) {
166+
const access = NativeModule.require('util').deprecate(function(val) {
167+
if (val) holders[name] = val;
168+
return holders[name];
169+
}, "'" + name + "' is deprecated, use 'global'");
170+
Object.defineProperty(global, name, {get: access, set: access});
171+
});
172+
164173
global.Buffer = NativeModule.require('buffer').Buffer;
165174
process.domain = null;
166175
process._exiting = false;

0 commit comments

Comments
 (0)