MCPcopy Create free account
hub / github.com/Starcounter-Jack/JSON-Patch / escapePathComponent

Function escapePathComponent

commonjs/helpers.js:84–88  ·  view source on GitHub ↗

* Escapes a json pointer path * @param path The raw pointer * @return the Escaped path

(path)

Source from the content-addressed store, hash-verified

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

Callers 1

_getPathRecursiveFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected