src/parse/patterns.js
function buildCollections(patternObj, options, collectionPromises = []) {
  if (isPattern(patternObj)) {
    return collectionPromises;
  }
  if (isCollection(patternObj)) {
    collectionPromises.push(buildCollection(patternObj, options));
  }
  for (const patternKey in patternObj) {
    if (patternKey !== 'collection') {
      buildCollections(patternObj[patternKey], options, collectionPromises);
    }
  }
  return collectionPromises;
}
function buildCollections(patternObj, options, collectionPromises = []) {
  if (isPattern(patternObj)) {
    return collectionPromises;
  }
  if (isCollection(patternObj)) {
    collectionPromises.push(buildCollection(patternObj, options));
  }
  for (const patternKey in patternObj) {
    if (patternKey !== 'collection') {
      buildCollections(patternObj[patternKey], options, collectionPromises);
    }
  }
  return collectionPromises;
}
function buildCollections ( patternObj , options , collectionPromises = [ ] ) { if ( isPattern ( patternObj ) ) { return collectionPromises ; } if ( isCollection ( patternObj ) ) { collectionPromises . push ( buildCollection ( patternObj , options ) ) ; } for ( const patternKey in patternObj ) { if ( patternKey !== 'collection' ) { buildCollections ( patternObj [ patternKey ] , options , collectionPromises ) ; } } return collectionPromises ; }
Traverse and build collections data and their contained patterns based on
parsed pattern data.

@param {Object} patternObj  Patterns at the current level of traverse.
@param {Object} options
@param {Array} collectionPromises Array of `{Promise}`s representing
reading collection metadata
Traverse and build collections data and their contained patterns based on parsed pattern data .