Download src/channels/plugins/normalize/shared.ts from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 528 Bytes
-
https://huggingface.co/Darochin/openskynet/resolve/main/src/channels/plugins/normalize/shared.ts
- Command line
-
hf download hf://Darochin/openskynet/src/channels/plugins/normalize/shared.ts
-
curl -L -o shared.ts https://huggingface.co/Darochin/openskynet/resolve/main/src/channels/plugins/normalize/shared.ts
528 Bytes
| export function trimMessagingTarget(raw: string): string | undefined { | |
| const trimmed = raw.trim(); | |
| return trimmed || undefined; | |
| } | |
| export function looksLikeHandleOrPhoneTarget(params: { | |
| raw: string; | |
| prefixPattern: RegExp; | |
| phonePattern?: RegExp; | |
| }): boolean { | |
| const trimmed = params.raw.trim(); | |
| if (!trimmed) { | |
| return false; | |
| } | |
| if (params.prefixPattern.test(trimmed)) { | |
| return true; | |
| } | |
| if (trimmed.includes("@")) { | |
| return true; | |
| } | |
| return (params.phonePattern ?? /^\+?\d{3,}$/).test(trimmed); | |
| } | |