Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 1x 1x 1x 1x 2x 1x 2x 1x | // https://datatracker.ietf.org/doc/html/rfc6901
export default function resolveJsonPointer(instance: any, pointer: string) {
let result = instance
const [, ...tokens] = pointer.split('/')
const parts = tokens.map((token) =>
token.replace(/~1/g, '/').replace(/~0/g, '~')
)
for (const part of parts) {
result = result && result[part]
}
return result
}
|