web_modules/forge.bundle.js
function _getBagsByAttribute(safeContents, attrName, attrValue, bagType) {
  var result = [];

  for(var i = 0; i < safeContents.length; i ++) {
    for(var j = 0; j < safeContents[i].safeBags.length; j ++) {
      var bag = safeContents[i].safeBags[j];
      if(bagType !== undefined && bag.type !== bagType) {
        continue;
      }
      // only filter by bag type, no attribute specified
      if(attrName === null) {
        result.push(bag);
        continue;
      }
      if(bag.attributes[attrName] !== undefined &&
        bag.attributes[attrName].indexOf(attrValue) >= 0) {
        result.push(bag);
      }
    }
  }

  return result;
}
function _getBagsByAttribute(safeContents, attrName, attrValue, bagType) {
  var result = [];

  for(var i = 0; i < safeContents.length; i ++) {
    for(var j = 0; j < safeContents[i].safeBags.length; j ++) {
      var bag = safeContents[i].safeBags[j];
      if(bagType !== undefined && bag.type !== bagType) {
        continue;
      }
      // only filter by bag type, no attribute specified
      if(attrName === null) {
        result.push(bag);
        continue;
      }
      if(bag.attributes[attrName] !== undefined &&
        bag.attributes[attrName].indexOf(attrValue) >= 0) {
        result.push(bag);
      }
    }
  }

  return result;
}
function _getBagsByAttribute ( safeContents , attrName , attrValue , bagType ) { var result = [ ] ; for ( var i = 0 ; i < safeContents . length ; i ++ ) { for ( var j = 0 ; j < safeContents [ i ] . safeBags . length ; j ++ ) { var bag = safeContents [ i ] . safeBags [ j ] ; if ( bagType !== undefined && bag . type !== bagType ) { continue ; } // only filter by bag type, no attribute specified
 if ( attrName === null ) { result . push ( bag ) ; continue ; } if ( bag . attributes [ attrName ] !== undefined && bag . attributes [ attrName ] . indexOf ( attrValue ) >= 0 ) { result . push ( bag ) ; } } } return result ; }
Search SafeContents structure for bags with matching attributes.

The search can optionally be narrowed by a certain bag type.

@param safeContents the SafeContents structure to search in.
@param attrName the name of the attribute to compare against.
@param attrValue the attribute value to search for.
@param [bagType] bag type to narrow search by.

@return an array of matching bags.
Search SafeContents structure for bags with matching attributes .