@fyresmith/hive-server 2.3.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ const MENTION_RE = /(^|\s)@([a-zA-Z0-9](?:[a-zA-Z0-9_.-]{0,62}[a-zA-Z0-9])?)(?=$|\s|[.,!?;:])/g;
2
+
3
+ export function parseMentions(text) {
4
+ if (typeof text !== 'string' || text.length === 0) return [];
5
+
6
+ const mentions = new Set();
7
+ let match;
8
+ while ((match = MENTION_RE.exec(text)) !== null) {
9
+ mentions.add(match[2].toLowerCase());
10
+ }
11
+
12
+ return [...mentions];
13
+ }