* Escapes a json pointer path * @param path The raw pointer * @return the Escaped path
(path)
| 82 | * @return the Escaped path |
| 83 | */ |
| 84 | function escapePathComponent(path) { |
| 85 | if (path.indexOf('/') === -1 && path.indexOf('~') === -1) |
| 86 | return path; |
| 87 | return path.replace(/~/g, '~0').replace(/\//g, '~1'); |
| 88 | } |
| 89 | exports.escapePathComponent = escapePathComponent; |
| 90 | /** |
| 91 | * Unescapes a json pointer path |