JavaScript github.com

Microdiff is a tiny, fast, zero dep object & array comparison library for JS/TS  ↦

<1kb light and claims to be “significantly faster than most other deep comparison libraries”, but current benchmarks (better ones coming soon) only cover one small and one very large object, so YMMV on the speed. Also full TypeScript support, if that’s your bag.

import diff from "microdiff";

const obj1 = {
	originalProperty: true,
};
const obj2 = {
	originalProperty: true,
	newProperty: "new",
};

console.log(diff(obj1, obj2));
// [{type: "CREATE", path: ["newProperty"], value: "new"}]

Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00