MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / isID

Function isID

lib/utils.ts:493–505  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

491}
492
493export function isID(str: string): boolean {
494 if (str.length < 10) return false;
495 if (isUUID(str)) return true;
496 if (isDate(str)) return false;
497 if (isEmail(str)) return false;
498 if (isMoneyValue(str)) return false;
499 if (isPhoneNumber(str)) return false;
500 if (isName(str)) return false;
501 const nTokens = tokenizer.encode(str).length;
502 const x = str.length / nTokens;
503 // Is an ID if there's less than 2.2 characters per token (threshold determined empirically)
504 return x <= 2.2;
505}
506
507export function isUrl(str: string): boolean {
508 if (/ID[1-9]+/.test(str)) return false;

Callers 2

findAndReplaceIDFunction · 0.90
isID.test.tsFile · 0.90

Calls 6

isUUIDFunction · 0.85
isDateFunction · 0.85
isEmailFunction · 0.85
isMoneyValueFunction · 0.85
isPhoneNumberFunction · 0.85
isNameFunction · 0.85

Tested by

no test coverage detected