npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

diffx-js

v0.7.1

Published

Node.js bindings for diffx - semantic diffing of JSON, YAML, TOML, XML, INI, and CSV files. Powered by Rust for blazing fast performance.

Readme

diffx

CI npm License: MIT

Node.js bindings for diffx - semantic diff for structured data (JSON, YAML, TOML, XML, INI, CSV). Powered by Rust via napi-rs for blazing fast performance.

Installation

npm install diffx

Supported Platforms

| Platform | Architecture | |----------|--------------| | Linux | x64 (glibc) | | Linux | x64 (musl/Alpine) | | Linux | ARM64 | | macOS | x64 (Intel) | | macOS | ARM64 (Apple Silicon) | | Windows | x64 |

Usage

Basic Diff

const { diff } = require('diffx');

const old = { name: "Alice", age: 30 };
const newObj = { name: "Alice", age: 31, city: "Tokyo" };

const results = diff(old, newObj);

for (const change of results) {
  console.log(`${change.diffType}: ${change.path}`);
  // Modified: age
  // Added: city
}

With Options

const results = diff(data1, data2, {
  epsilon: 0.001,           // Tolerance for float comparison
  arrayIdKey: 'id',         // Match array elements by ID
  ignoreKeysRegex: 'timestamp|updatedAt',  // Ignore keys matching regex
  pathFilter: 'user',       // Only show diffs in paths containing "user"
  ignoreCase: true,         // Ignore case differences
  ignoreWhitespace: true,   // Ignore whitespace differences
});

Parsers

Parse various formats to JavaScript objects:

const { parseJson, parseYaml, parseToml, parseCsv, parseIni, parseXml } = require('diffx');

const jsonObj = parseJson('{"name": "Alice"}');
const yamlObj = parseYaml('name: Alice\nage: 30');
const tomlObj = parseToml('name = "Alice"');
const csvArray = parseCsv('name,age\nAlice,30');
const iniObj = parseIni('[user]\nname = Alice');
const xmlObj = parseXml('<user><name>Alice</name></user>');

Format Output

const { diff, formatOutput } = require('diffx');

const results = diff(old, newObj);
console.log(formatOutput(results, 'json'));  // JSON format
console.log(formatOutput(results, 'yaml'));  // YAML format
console.log(formatOutput(results, 'diffx')); // diffx format

API Reference

diff(old, new, options?)

Compare two values and return differences.

Options: | Option | Type | Description | |--------|------|-------------| | epsilon | number | Tolerance for floating-point comparisons | | arrayIdKey | string | Key to identify array elements | | ignoreKeysRegex | string | Regex pattern for keys to ignore | | pathFilter | string | Only show diffs in matching paths | | outputFormat | string | Output format ("diffx", "json", "yaml") | | ignoreWhitespace | boolean | Ignore whitespace differences | | ignoreCase | boolean | Ignore case differences | | briefMode | boolean | Report only whether objects differ | | quietMode | boolean | Suppress normal output |

Returns: Array of JsDiffResult:

interface JsDiffResult {
  diffType: 'Added' | 'Removed' | 'Modified' | 'TypeChanged';
  path: string;
  oldValue?: any;   // For Modified/TypeChanged
  newValue?: any;   // For Added/Modified/TypeChanged
  value?: any;      // For Removed
}

Parsers

  • parseJson(content: string): any
  • parseYaml(content: string): any
  • parseToml(content: string): any
  • parseCsv(content: string): any[]
  • parseIni(content: string): any
  • parseXml(content: string): any

formatOutput(results, format)

Format diff results as string. Format: "json", "yaml", or "diffx".

Development

npm install     # Install dependencies
npm run build   # Build native module
npm test        # Run tests (51 tests)

License

MIT