Documentation
Getting Started
Installation, basic usage, and your first diff comparison.
API Reference
Complete API documentation for all diff functions.
Examples
Real-world usage examples and common patterns.
Quick Start
Get up and running with JSDiff in under 5 minutes.
// Install
npm install diff
// Import
import * as Diff from 'diff';
// Compare
const diff = Diff.diffChars('old text', 'new text');
console.log(diff);
Supported Diff Types
diffChars- Character by character comparisondiffWords- Word by word comparisondiffLines- Line by line comparisondiffJson- JSON object comparisoncreatePatch- Generate unified diff patchesapplyPatch- Apply patches to text