lib/repl.js
function promisify(repl) {
  var _eval = repl.eval;
  repl.eval = function(cmd, context, filename, callback) {
    _eval.call(repl, cmd, context, filename, function(err, res) {
      if (isPromiseLike(res)) {
        res.then(function(ret) {
          callback(null, ret);
        }, function(err) {
          callback(err);
        });
      } else {
        callback(err, res);
      }
    });
  };
  return repl;
}
function promisify(repl) {
  var _eval = repl.eval;
  repl.eval = function(cmd, context, filename, callback) {
    _eval.call(repl, cmd, context, filename, function(err, res) {
      if (isPromiseLike(res)) {
        res.then(function(ret) {
          callback(null, ret);
        }, function(err) {
          callback(err);
        });
      } else {
        callback(err, res);
      }
    });
  };
  return repl;
}
function promisify ( repl ) { var _eval = repl . eval ; repl . eval = function ( cmd , context , filename , callback ) { _eval . call ( repl , cmd , context , filename , function ( err , res ) { if ( isPromiseLike ( res ) ) { res . then ( function ( ret ) { callback ( null , ret ) ; } , function ( err ) { callback ( err ) ; } ) ; } else { callback ( err , res ) ; } } ) ; } ; return repl ; }
Intercept the evaled value when it is "promise", and resolve its value before sending back to REPL.
@private
Intercept the evaled value when it is promise and resolve its value before sending back to REPL .