12
shared/utils/parseMentionUrl.ts
Normal file
12
shared/utils/parseMentionUrl.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user