MCPcopy
hub / github.com/darkreader/darkreader / indexSitesFixesConfig

Function indexSitesFixesConfig

src/generators/utils/parse.ts:112–128  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

110}
111
112export function indexSitesFixesConfig(text: string): SiteFixesIndex {
113 const {urls, offsets: offsetsGrouped} = extractURLsFromSiteFixesConfig(text);
114 const offsetMap = new Map<string, [number, number]>();
115 const templates: string[] = [];
116 const offsets: Array<[number, number]> = []
117 urls.forEach((block, i) => {
118 block.forEach((u) => {
119 templates.push(u);
120 offsets.push(offsetsGrouped[i]);
121 offsetMap.set(u, offsetsGrouped[i]);
122 });
123 });
124 const indexedList = indexURLTemplateList(templates, (_, i) => {
125 return offsets[i];
126 });
127 return indexedList;
128}
129
130const siteFixesCache = new WeakMap<[number, number], any>();
131

Callers 5

handleDetectorHintsMethod · 0.90
handleInversionFixesMethod · 0.90
handleStaticThemesMethod · 0.90
parse.tests.tsFile · 0.90

Calls 3

indexURLTemplateListFunction · 0.90
setMethod · 0.65

Tested by

no test coverage detected