(detectorHints: DetectorHint[])
| 33 | } |
| 34 | |
| 35 | export function formatDetectorHints(detectorHints: DetectorHint[]): string { |
| 36 | const fixes = detectorHints.slice().sort((a, b) => compareURLPatterns(a.url[0], b.url[0])); |
| 37 | |
| 38 | return formatSitesFixesConfig(fixes, { |
| 39 | props: Object.values(detectorHintsCommands), |
| 40 | getPropCommandName: (prop) => Object.entries(detectorHintsCommands).find(([, p]) => p === prop)![0], |
| 41 | formatPropValue: (prop, value) => { |
| 42 | if (Array.isArray(value)) { |
| 43 | return formatArray(value).trim(); |
| 44 | } |
| 45 | if (prop === 'noDarkTheme' || prop === 'systemTheme') { |
| 46 | return ''; |
| 47 | } |
| 48 | return String(value).trim(); |
| 49 | }, |
| 50 | shouldIgnoreProp: (_prop, value) => { |
| 51 | return !value; |
| 52 | }, |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | export function getDetectorHintsFor(url: string, text: string, index: SiteFixesIndex): DetectorHint[] | null { |
| 57 | const fixes = getSitesFixesFor(url, text, index, parseDetectorHints); |
no test coverage detected