lib/plugins/context.js
function mergePartials(options) {
    var opts = utils.merge({}, this.options, options);
    var names = opts.mergeTypes || this.viewTypes.partial;
    var partials = {};
    var self = this;

    names.forEach(function(name) {
      var collection = self.views[name];
      for (var key in collection) {
        var view = collection[key];

        // handle `onMerge` middleware
        self.handleOnce('onMerge', view, function(err, res) {
          if (err) throw err;
          view = res;
        });

        if (view.options.nomerge) continue;
        if (opts.mergePartials !== false) {
          name = 'partials';
        }

        // convert the partial to:
        //=> {'foo.hbs': 'some content...'};
        partials[name] = partials[name] || {};
        partials[name][key] = view.content;
      }
    });
    return partials;
  }
function mergePartials(options) {
    var opts = utils.merge({}, this.options, options);
    var names = opts.mergeTypes || this.viewTypes.partial;
    var partials = {};
    var self = this;

    names.forEach(function(name) {
      var collection = self.views[name];
      for (var key in collection) {
        var view = collection[key];

        // handle `onMerge` middleware
        self.handleOnce('onMerge', view, function(err, res) {
          if (err) throw err;
          view = res;
        });

        if (view.options.nomerge) continue;
        if (opts.mergePartials !== false) {
          name = 'partials';
        }

        // convert the partial to:
        //=> {'foo.hbs': 'some content...'};
        partials[name] = partials[name] || {};
        partials[name][key] = view.content;
      }
    });
    return partials;
  }
function mergePartials ( options ) { var opts = utils . merge ( { } , this . options , options ) ; var names = opts . mergeTypes || this . viewTypes . partial ; var partials = { } ; var self = this ; names . forEach ( function ( name ) { var collection = self . views [ name ] ; for ( var key in collection ) { var view = collection [ key ] ; // handle `onMerge` middleware self . handleOnce ( 'onMerge' , view , function ( err , res ) { if ( err ) throw err ; view = res ; } ) ; if ( view . options . nomerge ) continue ; if ( opts . mergePartials !== false ) { name = 'partials' ; } // convert the partial to: //=> {'foo.hbs': 'some content...'}; partials [ name ] = partials [ name ] || { } ; partials [ name ] [ key ] = view . content ; } } ) ; return partials ; }
Merge "partials" view types. This is necessary for template
engines have no support for partials or only support one
type of partials.

@name .mergePartials
@param {Object} `options` Optionally pass an array of `viewTypes` to include on `options.viewTypes`
@return {Object} Merged partials
@api public
Merge partials view types . This is necessary for template engines have no support for partials or only support one type of partials .