| 92 | } |
| 93 | |
| 94 | Json applyRemoveOperation(Json const& base, Json const& op) { |
| 95 | String path = op.getString("path"); |
| 96 | auto pointer = JsonPath::Pointer(path); |
| 97 | |
| 98 | if (op.contains("search")) { |
| 99 | auto searchable = pointer.get(base); |
| 100 | auto searchValue = op.get("search"); |
| 101 | if (size_t index = findJsonMatch(searchable, searchValue, pointer)) |
| 102 | return pointer.add(pointer.remove(base), searchable.eraseIndex(index - 1)); |
| 103 | else |
| 104 | return base; |
| 105 | } else { |
| 106 | return pointer.remove(base); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | Json applyAddOperation(Json const& base, Json const& op) { |
| 111 | String path = op.getString("path"); |
nothing calls this directly
no test coverage detected