Skip to content

Commit 2593f83

Browse files
committed
Added matchURI
1 parent 131eada commit 2593f83

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

ts/Catalog.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,22 @@ export class Catalog {
322322
}
323323
return undefined;
324324
}
325+
326+
matchURI(uri: string): string | undefined {
327+
if (uri) {
328+
// Apply URI rewrites first
329+
for (let pair of this.uriRewrites) {
330+
if (uri.startsWith(pair[0])) {
331+
uri = pair[1] + uri.substring(pair[0].length);
332+
}
333+
}
334+
// Look up in URI catalog
335+
if (this.uriCatalog.has(uri)) {
336+
return this.uriCatalog.get(uri);
337+
}
338+
}
339+
return undefined;
340+
}
325341
}
326342

327343

0 commit comments

Comments
 (0)