v3.0 • Dev Tools • 6kb gzipped • MIT
DiffHawk
Structural diffing for objects and arrays, with patches you can apply, invert and store.

// why diffhawk
Patches, not just differences
Every diff is an applicable patch that can also be inverted, which makes undo and audit logs almost free.
// stack
Stable array diffs
Arrays diff by identity where you provide a key, so a reorder is a move rather than a delete and an insert.
DiffHawk started as a single file in a client project and stayed small on purpose. It does one job, it does it in 6kb gzipped, and it has no runtime dependencies.
Getting started
Install it, import it, call it:
npm i diffhawk-js
Every diff is an applicable patch that can also be inverted, which makes undo and audit logs almost free.
What it does not do
It does not manage your state, style your components or ship a plugin system. Those are your decisions, and keeping them out is what keeps the bundle honest.
- Invertible patches
- Keyed array diffing
- MIT licensed, commercially friendly
Features
Invertible patches
Apply a patch forwards or backwards from the same structure.
Keyed array diffing
Supply a key function and reorders stop looking like rewrites.
Readable reports
Terminal output for humans, JSON for everything else.
ESM and types
Ships module and CommonJS builds with hand-written type definitions and source maps.
CI first
Exits with a meaningful status code and prints machine-readable output on request.
Config optional
Sensible defaults mean DiffHawk does something useful before you configure anything.
Get DiffHawk v3.0
9 files • .min.js 6kb • .zip 31kb • sha384 verified
Changelog
- Invertible patch format
- Keyed array diffing
- Circular reference detection
- Type definitions rewritten by hand
- Dropped the last runtime dependency
- Safari 16 compatibility fixes
- Bundle size reduced by eleven percent
// related
Related products
ChartForge
Canvas charts in twelve lines. Responsive, accessible and dark-mode ready, with no D3 learning curve.
View →MotionEase
Physics-based micro-animations with a single call. Spring curves that feel right without a tuning session.
View →FormFlow
Validation and multi-step logic that works the same in React, Vue and vanilla. Your markup stays yours.
View →Wire it into CI today.
MIT licensed. Commercial friendly. Five-minute setup.