(
{ slug, weight, plugin }: CategoryRef,
plugins: ScoredReport['plugins'],
)
| 18 | } from './utils.js'; |
| 19 | |
| 20 | export function getSortableAuditByRef( |
| 21 | { slug, weight, plugin }: CategoryRef, |
| 22 | plugins: ScoredReport['plugins'], |
| 23 | ): SortableAuditReport { |
| 24 | const auditPlugin = plugins.find(p => p.slug === plugin); |
| 25 | if (!auditPlugin) { |
| 26 | throwIsNotPresentError(`Plugin ${plugin}`, 'report'); |
| 27 | } |
| 28 | const audit = auditPlugin.audits.find( |
| 29 | ({ slug: auditSlug }) => auditSlug === slug, |
| 30 | ); |
| 31 | if (!audit) { |
| 32 | throwIsNotPresentError(`Audit ${slug}`, auditPlugin.slug); |
| 33 | } |
| 34 | return { |
| 35 | ...audit, |
| 36 | weight, |
| 37 | plugin, |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | export function getSortedGroupAudits( |
| 42 | group: Group, |
no test coverage detected