lib/env.js
function normalize(file, fn) {
  var orig = utils.extend({}, file);

  // support paths
  if (typeof fn === 'string') {
    file.type = 'path';
    file.path = fn;
    file.origPath = fn;
    file = resolve(file, file.options);

  // support functions
  } else if (typeof fn === 'function') {
    file.type = 'function';
    file.path = file.name;
    file.fn = fn;

  // support instances
  } else if (utils.isAppArg(file.app)) {
    file.type = 'app';
    file.path = file.name;
    file.app = fn;

  } else {
    throw new TypeError('expected env to be a string or function');
  }

  if (file === null) {
    var name = typeof fn === 'string' ? fn : orig.key;
    throw new Error('cannot resolve: ' + util.inspect(name));
  }
  return file;
}
function normalize(file, fn) {
  var orig = utils.extend({}, file);

  // support paths
  if (typeof fn === 'string') {
    file.type = 'path';
    file.path = fn;
    file.origPath = fn;
    file = resolve(file, file.options);

  // support functions
  } else if (typeof fn === 'function') {
    file.type = 'function';
    file.path = file.name;
    file.fn = fn;

  // support instances
  } else if (utils.isAppArg(file.app)) {
    file.type = 'app';
    file.path = file.name;
    file.app = fn;

  } else {
    throw new TypeError('expected env to be a string or function');
  }

  if (file === null) {
    var name = typeof fn === 'string' ? fn : orig.key;
    throw new Error('cannot resolve: ' + util.inspect(name));
  }
  return file;
}
function normalize ( file , fn ) { var orig = utils . extend ( { } , file ) ; // support paths if ( typeof fn === 'string' ) { file . type = 'path' ; file . path = fn ; file . origPath = fn ; file = resolve ( file , file . options ) ; // support functions } else if ( typeof fn === 'function' ) { file . type = 'function' ; file . path = file . name ; file . fn = fn ; // support instances } else if ( utils . isAppArg ( file . app ) ) { file . type = 'app' ; file . path = file . name ; file . app = fn ; } else { throw new TypeError ( 'expected env to be a string or function' ) ; } if ( file === null ) { var name = typeof fn === 'string' ? fn : orig . key ; throw new Error ( 'cannot resolve: ' + util . inspect ( name ) ) ; } return file ; }
Create a file object with normalized `fn`, `path` or `app` properties
Create a file object with normalized fn path or app properties