code: function matchedMetadata(file, metadata) {
    for (let name in metadata) {
      const data = metadata[name];
      if (!data.pattern) return undefined;
      if (minimatch(file, data.pattern)) return data.metadata;
    }
    return undefined;
  }
docs: Checks if the given file matches the pattern in the metadata object and
  returns the metadata if there is a match.
  
  @param {string} file - File path.
  @param {Object} metadata - Object containing all metadata of all file
  patterns.
  
  @return {Object} Matching metadata.