Skip to content

v3.0 • Dev Tools • 6kb gzipped • MIT

DiffHawk

Structural diffing for objects and arrays, with patches you can apply, invert and store.

★ 5.0kGitHub
↓ 23.2k / week● MIT● TS 5.0+
diffhawk-preview.png
Abstract preview graphic for DiffHawk

// 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.

● 0 deps● 8ms cold start● CI ready

// 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

v3.0 Dec 20 2025 • latest
  • Invertible patch format
  • Keyed array diffing
  • Circular reference detection
v2.9 Oct 18 2025
  • Type definitions rewritten by hand
  • Dropped the last runtime dependency
v2.8.2 Aug 7 2025
  • Safari 16 compatibility fixes
  • Bundle size reduced by eleven percent
View full archive →

// related

Related products

Sep 10 • v2.0

ChartForge

Canvas charts in twelve lines. Responsive, accessible and dark-mode ready, with no D3 learning curve.

View →
Aug 30 • v3.2.1

MotionEase

Physics-based micro-animations with a single call. Spring curves that feel right without a tuning session.

View →
Aug 19 • v1.9.4

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.