MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / jsonEquals

Function jsonEquals

packages/plugins/openapi/src/sdk/spec-overrides.ts:258–277  ·  view source on GitHub ↗
(left: JsonValue, right: JsonValue)

Source from the content-addressed store, hash-verified

256});
257
258const 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
279const operationValue = Effect.fn("OpenApi.jsonPatchOperationValue")(function* (
280 operation: JsonPatchOperation,

Callers 1

applyOperationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected