lib/cli/repl.js
function injectBefore(replServer, method, beforeFn) {
  var _orig = replServer[method];
  replServer[method] = function() {
    var args = Array.prototype.slice.call(arguments);
    var callback = args.pop();
    beforeFn.apply(null, args.concat(function(err, res) {
      if (err || res) {
        callback(err, res);
      } else {
        _orig.apply(replServer, args.concat(callback));
      }
    }));
  };
  return replServer;
}
function injectBefore(replServer, method, beforeFn) {
  var _orig = replServer[method];
  replServer[method] = function() {
    var args = Array.prototype.slice.call(arguments);
    var callback = args.pop();
    beforeFn.apply(null, args.concat(function(err, res) {
      if (err || res) {
        callback(err, res);
      } else {
        _orig.apply(replServer, args.concat(callback));
      }
    }));
  };
  return replServer;
}
function injectBefore ( replServer , method , beforeFn ) { var _orig = replServer [ method ] ; replServer [ method ] = function ( ) { var args = Array . prototype . slice . call ( arguments ) ; var callback = args . pop ( ) ; beforeFn . apply ( null , args . concat ( function ( err , res ) { if ( err || res ) { callback ( err , res ) ; } else { _orig . apply ( replServer , args . concat ( callback ) ) ; } } ) ) ; } ; return replServer ; }
Intercept the evaled value returned from repl evaluator, convert and send back to output.
@private
Intercept the evaled value returned from repl evaluator convert and send back to output .