Files
outline/shared/utils/parseMentionUrl.ts
Apoorv Mishra 5d71398ea6 Preview mentions (#5571)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2023-07-22 09:13:09 -07:00

13 lines
301 B
TypeScript

const parseMentionUrl = (url: string) => {
const matches = url.match(
/^mention:\/\/([a-z0-9-]+)\/([a-z]+)\/([a-z0-9-]+)$/
);
if (!matches) {
return {};
}
const [id, mentionType, modelId] = matches.slice(1);
return { id, mentionType, modelId };
};
export default parseMentionUrl;