mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 22:21:51 +00:00
chore: clean up getInviteCodesInString
This commit is contained in:
parent
e586bfbda3
commit
48adb1df90
1 changed files with 1 additions and 9 deletions
|
@ -345,15 +345,7 @@ export function getUrlsInString(str: string, unique = false): url.URL[] {
|
||||||
|
|
||||||
export function getInviteCodesInString(str: string): string[] {
|
export function getInviteCodesInString(str: string): string[] {
|
||||||
const inviteCodeRegex = /(?:discord.gg|discordapp.com\/invite)\/([a-z0-9]+)/gi;
|
const inviteCodeRegex = /(?:discord.gg|discordapp.com\/invite)\/([a-z0-9]+)/gi;
|
||||||
const inviteCodes = [];
|
return Array.from(str.matchAll(inviteCodeRegex)).map(m => m[1]);
|
||||||
let match;
|
|
||||||
|
|
||||||
// tslint:disable-next-line
|
|
||||||
while ((match = inviteCodeRegex.exec(str)) !== null) {
|
|
||||||
inviteCodes.push(match[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return inviteCodes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unicodeEmojiRegex = emojiRegex();
|
export const unicodeEmojiRegex = emojiRegex();
|
||||||
|
|
Loading…
Add table
Reference in a new issue