function customRequire(shell, name) {
  var module = shell.requiredModules[name];
  if (module) {
    return module;
  }

  if (_knownModules[name]) {
    module = require(name);
  }
  else if (shell.installedModules[name]) {
    // Directly load up a specified custom module from where it would have been installed
    // when using the %module command.
    var modulePath = path.join(shell.config.userPath, 'node_modules', name);
    module = require(modulePath);
  }

  if (module) {
    shell.requiredModules[name] = module;
  }
  else {
    throw shell.createError('Unknown module "%s". Make sure it has been installed via %module.',
                            name);
  }

  return module;
}
function customRequire(shell, name) {
  var module = shell.requiredModules[name];
  if (module) {
    return module;
  }

  if (_knownModules[name]) {
    module = require(name);
  }
  else if (shell.installedModules[name]) {
    
    
    var modulePath = path.join(shell.config.userPath, 'node_modules', name);
    module = require(modulePath);
  }

  if (module) {
    shell.requiredModules[name] = module;
  }
  else {
    throw shell.createError('Unknown module "%s". Make sure it has been installed via %module.',
                            name);
  }

  return module;
}
function customRequire ( shell , name ) { var module = shell . requiredModules [ name ] ; if ( module ) { return module ; } if ( _knownModules [ name ] ) { module = require ( name ) ; } else if ( shell . installedModules [ name ] ) { // Directly load up a specified custom module from where it would have been installed // when using the %module command. var modulePath = path . join ( shell . config . userPath , 'node_modules' , name ) ; module = require ( modulePath ) ; } if ( module ) { shell . requiredModules [ name ] = module ; } else { throw shell . createError ( 'Unknown module "%s". Make sure it has been installed via %module.' , name ) ; } return module ; }
The implementation of the 'require' method that is made available within the shell. This satisfies required modules using a combination of known modules (standard and other modules available via the shell) and custom modules (previously installed using %module).
The implementation of the require method that is made available within the shell . This satisfies required modules using a combination of known modules ( standard and other modules available via the shell ) and custom modules ( previously installed using %module ) .