mirror of
https://github.com/outline/outline.git
synced 2026-05-06 18:12:33 -05:00
16 lines
348 B
TypeScript
16 lines
348 B
TypeScript
import { EmbedDescriptor } from "../embeds";
|
|
|
|
export function getMatchingEmbed(
|
|
embeds: EmbedDescriptor[],
|
|
href: string
|
|
): { embed: EmbedDescriptor; matches: RegExpMatchArray } | undefined {
|
|
for (const e of embeds) {
|
|
const matches = e.matcher(href);
|
|
if (matches) {
|
|
return { embed: e, matches };
|
|
}
|
|
}
|
|
|
|
return undefined;
|
|
}
|