(str: string)
| 491 | } |
| 492 | |
| 493 | export 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 | |
| 507 | export function isUrl(str: string): boolean { |
| 508 | if (/ID[1-9]+/.test(str)) return false; |
no test coverage detected