| 256 | }); |
| 257 | |
| 258 | const jsonEquals = (left: JsonValue, right: JsonValue): boolean => { |
| 259 | if (left === right) return true; |
| 260 | if (Array.isArray(left) || Array.isArray(right)) { |
| 261 | return ( |
| 262 | Array.isArray(left) && |
| 263 | Array.isArray(right) && |
| 264 | left.length === right.length && |
| 265 | left.every((entry, index) => jsonEquals(entry, right[index]!)) |
| 266 | ); |
| 267 | } |
| 268 | if (left === null || right === null || typeof left !== "object" || typeof right !== "object") { |
| 269 | return false; |
| 270 | } |
| 271 | const leftKeys = Object.keys(left); |
| 272 | const rightKeys = Object.keys(right); |
| 273 | return ( |
| 274 | leftKeys.length === rightKeys.length && |
| 275 | leftKeys.every((key) => Object.hasOwn(right, key) && jsonEquals(left[key]!, right[key]!)) |
| 276 | ); |
| 277 | }; |
| 278 | |
| 279 | const operationValue = Effect.fn("OpenApi.jsonPatchOperationValue")(function* ( |
| 280 | operation: JsonPatchOperation, |