index.js
function normalizeEngine(fn, options) {
  if (utils.isEngine(options)) {
    return normalizeEngine(options, fn); //<= reverse args
  }

  if (!isObject(fn) && typeof fn !== 'function') {
    throw new TypeError('expected an object or function');
  }

  var engine = {};
  engine.render = fn.render || fn;
  engine.options = extend({}, options);

  if (typeof engine.render !== 'function') {
    throw new Error('expected engine to have a render method');
  }

  var keys = Object.keys(fn);
  var len = keys.length;
  var idx = -1;
  while (++idx < len) {
    var key = keys[idx];
    if (key === 'options') {
      engine.options = extend({}, engine.options, fn[key]);
      continue;
    }
    if (key === '__express' && !fn.hasOwnProperty('renderFile')) {
      engine.renderFile = fn[key];
    }
    engine[key] = fn[key];
  }
  return engine;
}
function normalizeEngine(fn, options) {
  if (utils.isEngine(options)) {
    return normalizeEngine(options, fn); //<= reverse args
  }

  if (!isObject(fn) && typeof fn !== 'function') {
    throw new TypeError('expected an object or function');
  }

  var engine = {};
  engine.render = fn.render || fn;
  engine.options = extend({}, options);

  if (typeof engine.render !== 'function') {
    throw new Error('expected engine to have a render method');
  }

  var keys = Object.keys(fn);
  var len = keys.length;
  var idx = -1;
  while (++idx < len) {
    var key = keys[idx];
    if (key === 'options') {
      engine.options = extend({}, engine.options, fn[key]);
      continue;
    }
    if (key === '__express' && !fn.hasOwnProperty('renderFile')) {
      engine.renderFile = fn[key];
    }
    engine[key] = fn[key];
  }
  return engine;
}
function normalizeEngine ( fn , options ) { if ( utils . isEngine ( options ) ) { return normalizeEngine ( options , fn ) ; //<= reverse args } if ( ! isObject ( fn ) && typeof fn !== 'function' ) { throw new TypeError ( 'expected an object or function' ) ; } var engine = { } ; engine . render = fn . render || fn ; engine . options = extend ( { } , options ) ; if ( typeof engine . render !== 'function' ) { throw new Error ( 'expected engine to have a render method' ) ; } var keys = Object . keys ( fn ) ; var len = keys . length ; var idx = - 1 ; while ( ++ idx < len ) { var key = keys [ idx ] ; if ( key === 'options' ) { engine . options = extend ( { } , engine . options , fn [ key ] ) ; continue ; } if ( key === '__express' && ! fn . hasOwnProperty ( 'renderFile' ) ) { engine . renderFile = fn [ key ] ; } engine [ key ] = fn [ key ] ; } return engine ; }
Normalize engine so that `.render` is a property on the `engine` object.
Normalize engine so that . render is a property on the engine object .