ra.js
function(dirname) {
  var result;

  if (!fs.test('-d', dirname))  { return result; }

  result = {};
  _.each(sg.fs.ls(dirname), (name_) => {
    const name      = path.basename(name_, '.js');
    const filename  = path.join(dirname, name);
    if (!fs.test('-f', `${filename}.js`)) { return; }   // skip
    if (name.startsWith('helper'))        { return; }   // skip helper(s).js

    result[name] = result[name] || {};
    _.extend(result[name], libRa.middlewareify(safeRequire(filename)));
  });

  return result;
}
function(dirname) {
  var result;

  if (!fs.test('-d', dirname))  { return result; }

  result = {};
  _.each(sg.fs.ls(dirname), (name_) => {
    const name      = path.basename(name_, '.js');
    const filename  = path.join(dirname, name);
    if (!fs.test('-f', `${filename}.js`)) { return; }   // skip
    if (name.startsWith('helper'))        { return; }   // skip helper(s).js

    result[name] = result[name] || {};
    _.extend(result[name], libRa.middlewareify(safeRequire(filename)));
  });

  return result;
}
function ( dirname ) { var result ; if ( ! fs . test ( '-d' , dirname ) ) { return result ; } result = { } ; _ . each ( sg . fs . ls ( dirname ) , ( name_ ) => { const name = path . basename ( name_ , '.js' ) ; const filename = path . join ( dirname , name ) ; if ( ! fs . test ( '-f' , ` ${ filename } ` ) ) { return ; } // skip if ( name . startsWith ( 'helper' ) ) { return ; } // skip helper(s).js result [ name ] = result [ name ] || { } ; _ . extend ( result [ name ] , libRa . middlewareify ( safeRequire ( filename ) ) ) ; } ) ; return result ; }
Loads all the scripts in a dir.
Loads all the scripts in a dir .