jsdiff is a JavaScript text differencing library that computes the minimal set of changes needed to transform one text into another.
The tool solves the problem of identifying what has changed between two versions of text. It works by tokenizing both input strings according to a specified granularity (characters, words, lines, or sentences), then applying the Myers difference algorithm to find the smallest set of insertions and deletions that transform the first token array into the second. The algorithm returns an ordered array of change objects representing each insertion, deletion, or unchanged section. The tool supports configurable equality semantics, such as case-insensitive comparison, which affects how tokens are matched during the diff computation.
Developers should choose this tool when they need programmatic access to text differences in a JavaScript environment. It suits projects requiring character-level, word-level, line-level, or sentence-level diffs, and it works both in Node.js and browser contexts through ESM imports, CommonJS requires, or a global API. The library is particularly useful when you need fine-grained control over what constitutes a token and how equality is determined between tokens, rather than just a human-readable diff output.
The project maintains a stable, focused codebase centered on the core differencing algorithms. Development activity shows consistent attention to the implementation without frequent breaking changes, suggesting the API has reached a mature state. The tool includes an interactive online demo that allows users to experiment with different diff functions and options before integrating the library into their own code.