diff --git a/lib/repl.js b/lib/repl.js index 84293e2c4ea..89ac5685f67 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -101,12 +101,12 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) { var self = this; - self.useGlobal = useGlobal; + self.useGlobal = !!useGlobal; self.eval = eval || function(code, context, file, cb) { var err, result; try { - if (useGlobal) { + if (self.useGlobal) { result = vm.runInThisContext(code, file); } else { result = vm.runInContext(code, context, file);