(path: string)
| 45 | * @returns 是否为有效的 JSON Pointer |
| 46 | */ |
| 47 | export function isValidJsonPointer(path: string): boolean { |
| 48 | if (typeof path !== 'string') { |
| 49 | return false; |
| 50 | } |
| 51 | // 空字符串表示整个文档 |
| 52 | if (path === '') { |
| 53 | return true; |
| 54 | } |
| 55 | // 必须以 "/" 开头 |
| 56 | return path.startsWith('/'); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * 解码 JSON Pointer 转义字符 |
no outgoing calls
no test coverage detected