lighthouse-core/fraggle-rock/config/filters.js
/**
 * Filters an array of audits down to the set that can be computed using only the specified artifacts.
 *
 * @param {LH.Config.FRConfig['audits']} audits
 * @param {Array<LH.Config.ArtifactDefn>} availableArtifacts
 * @return {LH.Config.FRConfig['audits']}
 */
Filters an array of audits down to the set that can be computed using only the specified artifacts.
Filters an array of audits down to the set that can be computed using only the specified artifacts .
function filterAuditsByAvailableArtifacts(audits, availableArtifacts) {
  if (!audits) return null;
  const availableAritfactIds = new Set(
    availableArtifacts.map(artifact => artifact.id).concat(baseArtifactKeys)
  );
  return audits.filter(audit =>
    audit.implementation.meta.requiredArtifacts.every(id => availableAritfactIds.has(id))
  );
}
function filterAuditsByAvailableArtifacts ( audits , availableArtifacts ) { if ( ! audits ) return null ; const availableAritfactIds = new Set ( availableArtifacts . map ( artifact => artifact . id ) . concat ( baseArtifactKeys ) ) ; return audits . filter ( audit => audit . implementation . meta . requiredArtifacts . every ( id => availableAritfactIds . has ( id ) ) ) ; }
Filters an array of audits down to the set that can be computed using only the specified artifacts.
Filters an array of audits down to the set that can be computed using only the specified artifacts .