(str: any)
| 60 | * 是一个MongoDB的objectId |
| 61 | */ |
| 62 | export function isObjectId(str: any): boolean { |
| 63 | if (typeof str === 'string' && str.length === 12) { |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | if (typeof str === 'string' && /^[0-9A-Fa-f]{24}$/.test(str)) { |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | return false; |
| 72 | } |
no outgoing calls
no test coverage detected