code: function(name) {
    var path = require.resolve(name)
      , module = require.cache[path]
      , func
      , ret;
  
    if (!module) {
      throw new
        Error('Cannot find module \'' + name + '\'');
    }
  
    if (!module.exports) {
      func = module;
      module = { 
        exports: {}, 
        id: path, 
        require: require 
      };
      require.cache[path] = module;
      ret = func(require, module.exports, module);
      if (ret !== undefined) module.exports = ret;
    }
  
    return module.exports;
  }
docs: Module Loading