* Validates JSON pointer string. * * @param pointer * @returns {boolean}
(pointer)
| 83 | * @returns {boolean} |
| 84 | */ |
| 85 | function 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 | /** |
no outgoing calls
no test coverage detected