MCPcopy Create free account
hub / github.com/cloudflarearchive/json-schema-docs-generator / isValidJSONPointer

Function isValidJSONPointer

lib/pointer.js:85–99  ·  view source on GitHub ↗

* Validates JSON pointer string. * * @param pointer * @returns {boolean}

(pointer)

Source from the content-addressed store, hash-verified

83 * @returns {boolean}
84 */
85function isValidJSONPointer(pointer) {
86 if (!_.isString(pointer)) {
87 // If it's not a string, it obviously is not valid.
88 return false;
89 }
90
91 // If it is string and is an empty string, it's valid.
92 if ('' === pointer) {
93 return true;
94 }
95
96 // If it is non-empty string, it must match spec defined format.
97 // Check Section 3 of specification for concrete syntax.
98 return validPointerRegex.test(pointer);
99}
100
101
102/**

Callers 1

createPointerEvaluatorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected