repl: ensure that 'repl.ignoreUndefined' is a boolean

This commit is contained in:
Nathan Rajlich
2012-03-27 17:35:33 -07:00
parent e7065eaa93
commit 228ddddc1c

View File

@@ -102,6 +102,7 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
var self = this;
self.useGlobal = !!useGlobal;
self.ignoreUndefined = !!ignoreUndefined;
self.eval = eval || function(code, context, file, cb) {
var err, result;
@@ -290,7 +291,7 @@ function REPLServer(prompt, stream, eval, useGlobal, ignoreUndefined) {
self.bufferedCommand = '';
// If we got any output - print it (if no error)
if (!e && (!ignoreUndefined || ret !== undefined)) {
if (!e && (!self.ignoreUndefined || ret !== undefined)) {
self.context._ = ret;
self.outputStream.write(exports.writer(ret) + '\n');
}