lib/definitions/collection.js
function (query) {
    if (!query || !_.isObject(query)) {
      return this.viewBuilders;
    }
    query.name = query.name || '';
    query.version = query.version || 0;
    query.aggregate = query.aggregate || null;
    query.context = query.context || null;
    var found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
            (vB.version === query.version || vB.version === -1) &&
            (vB.aggregate === query.aggregate) &&
            (vB.context === query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate || !query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    return _.filter(this.viewBuilders, function (vB) {
      return vB.name === '' &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate || !query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
  }
function (query) {
    if (!query || !_.isObject(query)) {
      return this.viewBuilders;
    }
    query.name = query.name || '';
    query.version = query.version || 0;
    query.aggregate = query.aggregate || null;
    query.context = query.context || null;
    var found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
            (vB.version === query.version || vB.version === -1) &&
            (vB.aggregate === query.aggregate) &&
            (vB.context === query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    found = _.filter(this.viewBuilders, function (vB) {
      return vB.name === query.name &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate || !query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
    if (found.length !== 0) {
      return found;
    }
    return _.filter(this.viewBuilders, function (vB) {
      return vB.name === '' &&
        (vB.version === query.version || vB.version === -1) &&
        (vB.aggregate === query.aggregate || !query.aggregate) &&
        (vB.context === query.context || !query.context);
    });
  }
function ( query ) { if ( ! query || ! _ . isObject ( query ) ) { return this . viewBuilders ; } query . name = query . name || '' ; query . version = query . version || 0 ; query . aggregate = query . aggregate || null ; query . context = query . context || null ; var found = _ . filter ( this . viewBuilders , function ( vB ) { return vB . name === query . name && ( vB . version === query . version || vB . version === - 1 ) && ( vB . aggregate === query . aggregate ) && ( vB . context === query . context ) ; } ) ; if ( found . length !== 0 ) { return found ; } found = _ . filter ( this . viewBuilders , function ( vB ) { return vB . name === query . name && ( vB . version === query . version || vB . version === - 1 ) && ( vB . aggregate === query . aggregate ) && ( vB . context === query . context || ! query . context ) ; } ) ; if ( found . length !== 0 ) { return found ; } found = _ . filter ( this . viewBuilders , function ( vB ) { return vB . name === query . name && ( vB . version === query . version || vB . version === - 1 ) && ( vB . aggregate === query . aggregate || ! query . aggregate ) && ( vB . context === query . context || ! query . context ) ; } ) ; if ( found . length !== 0 ) { return found ; } return _ . filter ( this . viewBuilders , function ( vB ) { return vB . name === '' && ( vB . version === query . version || vB . version === - 1 ) && ( vB . aggregate === query . aggregate || ! query . aggregate ) && ( vB . context === query . context || ! query . context ) ; } ) ; }
Returns the viewBuilder module by query.
@param {Object} query The query object. [optional] If not passed, all viewBuilders will be returned.
@returns {Array}
Returns the viewBuilder module by query .