index.js
function(name, options, fn) {
        debug('.lookupGenerator', name);
        if (typeof options === 'function') {
          fn = options;
          options = {};
        }

        if (typeof fn !== 'function') {
          throw new TypeError('expected `fn` to be a lookup function');
        }

        options = options || {};

        // remove `lookup` fn from options to prevent self-recursion
        delete this.options.lookup;
        delete options.lookup;

        var names = fn(name);
        debug('looking up generator "%s" with "%j"', name, names);

        var len = names.length;
        var idx = -1;

        while (++idx < len) {
          var gen = this.findGenerator(names[idx], options);
          if (gen) {
            this.options.lookup = fn;
            return gen;
          }
        }

        this.options.lookup = fn;
      }
function(name, options, fn) {
        debug('.lookupGenerator', name);
        if (typeof options === 'function') {
          fn = options;
          options = {};
        }

        if (typeof fn !== 'function') {
          throw new TypeError('expected `fn` to be a lookup function');
        }

        options = options || {};

        // remove `lookup` fn from options to prevent self-recursion
        delete this.options.lookup;
        delete options.lookup;

        var names = fn(name);
        debug('looking up generator "%s" with "%j"', name, names);

        var len = names.length;
        var idx = -1;

        while (++idx < len) {
          var gen = this.findGenerator(names[idx], options);
          if (gen) {
            this.options.lookup = fn;
            return gen;
          }
        }

        this.options.lookup = fn;
      }
function ( name , options , fn ) { debug ( '.lookupGenerator' , name ) ; if ( typeof options === 'function' ) { fn = options ; options = { } ; } if ( typeof fn !== 'function' ) { throw new TypeError ( 'expected `fn` to be a lookup function' ) ; } options = options || { } ; // remove `lookup` fn from options to prevent self-recursion delete this . options . lookup ; delete options . lookup ; var names = fn ( name ) ; debug ( 'looking up generator "%s" with "%j"' , name , names ) ; var len = names . length ; var idx = - 1 ; while ( ++ idx < len ) { var gen = this . findGenerator ( names [ idx ] , options ) ; if ( gen ) { this . options . lookup = fn ; return gen ; } } this . options . lookup = fn ; }
Tries to find a registered generator that matches `name`
by iterating over the `generators` object, and doing a strict
comparison of each name returned by the given lookup `fn`.
The lookup function receives `name` and must return an array
of names to use for the lookup.

For example, if the lookup `name` is `foo`, the function might
return `["generator-foo", "foo"]`, to ensure that the lookup happens
in that order.

@param {String} `name` Generator name to search for
@param {Object} `options`
@param {Function} `fn` Lookup function that must return an array of names.
@return {Object}
@api public
Tries to find a registered generator that matches name by iterating over the generators object and doing a strict comparison of each name returned by the given lookup fn . The lookup function receives name and must return an array of names to use for the lookup .