Typed deep diff
Path-aware records for objects, arrays, Dates, Maps, and Sets — plus ignore / include.
@jayoncode/object-diff
Stop guessing what changed. Get paths, patches, and review-ready output.
Typed deep comparison with path-aware records, fast dirty checks, DiffView explain, RFC 6902 patches, and optional snapshot merge — not a CRDT runtime.
import { diff, hasChanges, patch, applyPatch } from "@jayoncode/object-diff";
import { createDiffView } from "@jayoncode/object-diff/view";
const saved = {
profile: { name: "Ada", role: "admin" },
prefs: { theme: "dark" },
};
const draft = {
profile: { name: "Ada Lovelace", role: "admin" },
prefs: { theme: "dark" },
};
if (hasChanges(saved, draft)) {
const view = createDiffView(diff(saved, draft));
await audit.log(view.explain({ format: "human" }));
const synced = applyPatch(saved, view.patch());
}Path-aware records for objects, arrays, Dates, Maps, and Sets — plus ignore / include.
detectMoves for reorders; hasChanges for cheap dirty flags without a full DiffResult.
createDiffView(result).explain() turns moves and edits into review-ready structured or human text.
Generate, validate, apply, and inverse patches for optimistic UI and audit trails.
Optional /merge with identity-aware lists and structured conflicts — not live collab.