(inversionFixes: InversionFix[])
| 236 | } |
| 237 | |
| 238 | export function formatInversionFixes(inversionFixes: InversionFix[]): string { |
| 239 | const fixes = inversionFixes.slice().sort((a, b) => compareURLPatterns(a.url[0], b.url[0])); |
| 240 | |
| 241 | return formatSitesFixesConfig(fixes, { |
| 242 | props: Object.values(inversionFixesCommands), |
| 243 | getPropCommandName: (prop) => Object.entries(inversionFixesCommands).find(([, p]) => p === prop)![0], |
| 244 | formatPropValue: (prop, value) => { |
| 245 | if (prop === 'css') { |
| 246 | return (value as string).trim().replace(/\n+/g, '\n'); |
| 247 | } |
| 248 | return formatArray(value as string[]).trim(); |
| 249 | }, |
| 250 | shouldIgnoreProp: (prop, value) => { |
| 251 | if (prop === 'css') { |
| 252 | return !value; |
| 253 | } |
| 254 | return !(Array.isArray(value) && value.length > 0); |
| 255 | }, |
| 256 | }); |
| 257 | } |
no test coverage detected