jest-diff
- Version 29.7.0
- Published
- 78.5 kB
- 4 dependencies
- MIT license
Install
npm i jest-diff
yarn add jest-diff
pnpm add jest-diff
Overview
Display differences clearly so people can review changes confidently.
Index
Variables
variable DIFF_DELETE
var DIFF_DELETE: number;
The data structure representing a diff is an array of tuples: [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] which means: delete 'Hello', add 'Goodbye' and keep ' world.'
variable DIFF_EQUAL
var DIFF_EQUAL: number;
variable DIFF_INSERT
var DIFF_INSERT: number;
Functions
function diff
diff: (a: any, b: any, options?: DiffOptions) => string | null;
function diffLinesRaw
diffLinesRaw: (aLines: Array<string>, bLines: Array<string>) => Array<Diff>;
function diffLinesUnified
diffLinesUnified: ( aLines: Array<string>, bLines: Array<string>, options?: DiffOptions) => string;
function diffLinesUnified2
diffLinesUnified2: ( aLinesDisplay: Array<string>, bLinesDisplay: Array<string>, aLinesCompare: Array<string>, bLinesCompare: Array<string>, options?: DiffOptions) => string;
function diffStringsRaw
diffStringsRaw: (a: string, b: string, cleanup: boolean) => Array<Diff>;
function diffStringsUnified
diffStringsUnified: (a: string, b: string, options?: DiffOptions) => string;
Classes
class Diff
class Diff {}
Class representing one diff tuple. Attempts to look like a two-element array (which is what this used to be).
Parameter op
Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
Parameter text
Text to be deleted, inserted, or retained.
Type Aliases
type DiffOptions
type DiffOptions = { aAnnotation?: string; aColor?: DiffOptionsColor; aIndicator?: string; bAnnotation?: string; bColor?: DiffOptionsColor; bIndicator?: string; changeColor?: DiffOptionsColor; changeLineTrailingSpaceColor?: DiffOptionsColor; commonColor?: DiffOptionsColor; commonIndicator?: string; commonLineTrailingSpaceColor?: DiffOptionsColor; contextLines?: number; emptyFirstOrLastLinePlaceholder?: string; expand?: boolean; includeChangeCounts?: boolean; omitAnnotationLines?: boolean; patchColor?: DiffOptionsColor; compareKeys?: CompareKeys;};
type DiffOptionsColor
type DiffOptionsColor = (arg: string) => string;
Package Files (1)
Dependencies (4)
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jest-diff
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/jest-diff)
- HTML<a href="https://www.jsdocs.io/package/jest-diff"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3533 ms. - Missing or incorrect documentation? Open an issue for this package.