diff
JavaScript text diff implementation for comparing and generating unified diffs.
Utilities npm BSD-3-Clause
Used in agent projects
41
0.3% of 12,697 public repos built with AI coding agents
Rank in utilities
#52 of 109
by use in those projects
Downloads
144M
npm, last 7 days, diff
GitHub stars
9,210
last push Oct 7, 2026
How diff is used
diff is a dependency in 41 of the 12,697 public GitHub projects set up for AI coding agents that we scanned (0.3%), #52 of 109 in utilities. The most used alternative there is clsx. Projects that use it most often also use Vitest (63.4%), tsx (61.0%), Zod (63.4%).
Often used with diff
| Vitest | 63.4% of diff projects · 5.2× more than average |
|---|---|
| tsx | 61.0% of diff projects · 6.1× more than average |
| Zod | 63.4% of diff projects · 3.7× more than average |
| Model Context Protocol SDK (JavaScript) | 46.3% of diff projects · 9.8× more than average |
| Playwright (JavaScript) | 41.5% of diff projects · 4.7× more than average |
| yaml | 36.6% of diff projects · 28.3× more than average |
| TypeScript | 87.8% of diff projects · 1.6× more than average |
| esbuild | 34.1% of diff projects · 12.7× more than average |
By coding agent
| Claude Code | 0.9% of projects set up for it |
|---|---|
| GitHub Copilot | 0.6% of projects set up for it |
| Cursor | 0.4% of projects set up for it |
| OpenAI Codex | 1.3% of projects set up for it |
Share of public repos configured for each agent that list diff as a dependency.
Install
| Package | npm install diff |
|---|---|
| Main stacks | TypeScript / JavaScript (35), Next.js (3), PHP (2), Python (1) |
| Example projects | msrbuilds/elementor-mcp, 5pyj29s7cm-tech/LumiCore, linuxscreen/duo-translator, awslabs/nx-plugin-for-aws, BabylonSocial/babylon |
Alternatives to diff
| Tool | Used in agent projects | Downloads / wk | GitHub stars | License |
|---|---|---|---|---|
| clsx npm Tiny utility for conditionally constructing className strings. |
2,251 (17.7%) | 126M | 9,847 | MIT |
| date-fns npm Modern JavaScript date utility library with comprehensive formatting functions. |
1,079 (8.5%) | 97.6M | 36.6K | MIT |
| uuid npm Generate RFC9562 compliant UUIDs for unique identifiers in applications. |
454 (3.6%) | 296M | 15.3K | MIT |
| PyYAML pypi YAML parser and emitter for reading and writing YAML configuration files. |
385 (3.0%) | 239M | 2,954 | MIT |
| Lodash npm Modular utility library with methods for common programming tasks and data manipulation. |
269 (2.1%) | 162M | 61.4K | MIT |
| bn.js npm Big number library for handling arbitrary-precision integers in JavaScript. |
217 (1.7%) | 62.1M | 1,230 | MIT |
| python-dateutil pypi Extensions to Python's datetime module for advanced date and time manipulation. |
165 (1.3%) | 233M | 2,638 | Dual License |
| yaml npm JavaScript YAML parser and stringifier with full spec compliance. |
164 (1.3%) | 179M | 1,693 | ISC |