A JavaScript library for diffing and patching plain objects and arrays, including nested structures. Current stable version is 0.6.0, released as an ES module with TypeScript type definitions. It uses LCS (Longest Common Subsequence) for smart array diffing, supports reverse deltas, unpatching, and optional output formatters. Optionally leverages google-diff-match-patch for long text diffs. Compared to similar libraries, diffpatch focuses on pure JSON delta format and low footprint (~16KB min+gzipped), and requires an objectHash function for object identity matching in arrays.
No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Named export only; no default export. Since v0.5.0, ESM is used.
Named export for JSON.parse reviver support for Date objects. Works in CommonJS as well.
formatters is an object containing html, annotated, etc. Access via formatters.html, etc. ESM-only exports.
createPatcher was removed in v0.5.0. Use new DiffPatcher() instead.
Basic diff, patch, and unpatch operations with primitive and array values using DiffPatcher.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.