Skip to content

v0.3.0

Choose a tag to compare

@nemanjatesic nemanjatesic released this 17 Feb 22:31
· 7 commits to main since this release

Release Notes — v0.3.0

Date: 2026-02-17

Highlights

This release introduces path ignoring with a flexible pattern system and promotes expandJsonStrings from a CLI-only flag to a first-class core option.


New Features

ignorePaths option (core + CLI)

Selectively skip paths during diffing using an array of pattern strings. Ignored paths (and their children) are silently excluded from the result — across all output formats, convenience functions, and the CLI.

Pattern rules:

Pattern Matches Example
"foo.bar" Exact path "foo.bar" only
"*.type" Any path ending with .type (requires a parent) "a.type", "x.y.type"
"**.id" .id at any depth, including top-level "id", "a.id", "a.b.c.id"
"settings.*" Any path under settings "settings.theme", "settings[0]"

Core usage:

import { diff, hasDiff } from 'deep-obj-diff';

const result = diff(oldObj, newObj, {
  ignorePaths: ['**.id', '*.type', 'metadata.timestamp'],
});

// Works with all convenience functions
hasDiff(a, b, { ignorePaths: ['**.id'] });

CLI usage:

deep-obj-diff old.json new.json -i "**.id" -i "metadata.timestamp"
deep-obj-diff old.json new.json --ignore "*.type" --ignore "build.*"

The -i / --ignore flag is repeatable — each occurrence adds a pattern.

expandJsonStrings promoted to core

Previously a CLI-only feature, expandJsonStrings is now available directly on DiffOptions. String values containing valid JSON are recursively parsed before diffing so their inner structure is compared instead of the raw string.

const result = diff(
  { data: '{"name":"Alice"}' },
  { data: '{"name":"Bob"}' },
  { expandJsonStrings: true },
);
// => [{ kind: 'changed', path: 'data.name', lhs: 'Alice', rhs: 'Bob' }]

Engine Improvements

  • ignorePaths applied to all code paths — additions, removals, ordered & unordered array diffs, and recursive changes all respect ignore patterns.
  • Extracted EngineOptions type — internal engine options are now a single named type, eliminating duplication between collectChanges and diffArrays.
  • isIgnored() helper — centralizes the ignore check logic to keep the engine DRY.

Testing

  • 86 new tests in a dedicated tests/ignorePaths.test.ts covering:
    • All four pattern types (exact, *.suffix, **.suffix, prefix.*)
    • Arrays (ordered, unordered, nested, specific indices)
    • Additions and removals
    • Interaction with includeUnchanged, maxDepth, filter, expandJsonStrings, isEqual, arrayOrderMatters
    • All output formats (list, flat, nested, patch, custom formatter)
    • Convenience functions (hasDiff, addedDiff, removedDiff, changedDiff)
    • Edge cases (empty array, 50-key objects, 6-level nesting, null/undefined, Date)
    • Complex real-world scenarios (API responses, configs, DB records, K8s manifests, event logs, form state)
  • Total: 199 tests, all passing.

Breaking Changes

None.


Full Changelog

  • c610ccd feat: add ignorePaths option with pattern matching
  • c9f7514 feat: move expandJsonStrings to core DiffOptions
  • 6360b30 fix(ci): build before test so CLI tests can find dist/