MCPcopy Index your code
hub / github.com/darkreader/darkreader / formatStaticThemes

Function formatStaticThemes

src/generators/static-theme.ts:239–258  ·  view source on GitHub ↗
(staticThemes: StaticTheme[])

Source from the content-addressed store, hash-verified

237}
238
239export function formatStaticThemes(staticThemes: StaticTheme[]): string {
240 const themes = staticThemes.slice().sort((a, b) => compareURLPatterns(a.url[0], b.url[0]));
241
242 return formatSitesFixesConfig(themes, {
243 props: Object.values(staticThemeCommands),
244 getPropCommandName: camelCaseToUpperCase,
245 formatPropValue: (prop, value) => {
246 if (prop === 'noCommon') {
247 return '';
248 }
249 return formatArray(value as string[]).trim();
250 },
251 shouldIgnoreProp: (prop, value) => {
252 if (prop === 'noCommon') {
253 return !value;
254 }
255 return !(Array.isArray(value) && value.length > 0);
256 },
257 });
258}

Callers 3

getStaticThemesTextMethod · 0.90
applyStaticThemesMethod · 0.90
config.tests.tsFile · 0.90

Calls 3

compareURLPatternsFunction · 0.90
formatSitesFixesConfigFunction · 0.90
formatArrayFunction · 0.90

Tested by

no test coverage detected