UNPKG

@cowwoc/requirements

Version:

A fluent API for enforcing design contracts with automatic message generation.

47 lines (46 loc) 1.39 kB
import { DiffResult, TerminalEncoding } from "../../internal.mjs"; /** * Generates a diff of two Strings. */ declare class DiffGenerator { private readonly encoding; private readonly paddingMarker; private readonly simplifyDeltas; /** * @param encoding - the terminal encoding * @throws AssertionError if `encoding` is `undefined` or `null` */ constructor(encoding: TerminalEncoding); /** * @returns the padding character used to align values vertically */ private getPaddingMarker; /** * Generates the diff of two strings. * <p> * <b>NOTE</b>: Colors may be disabled when stdin or stdout are redirected. To override this * behavior, use {@link GlobalConfiguration.terminalEncoding}. * * @param actual - the actual value * @param expected - the expected value * @returns the calculated diff */ diff(actual: string, expected: string): DiffResult; /** * Write a single delta. * * @param delta - a delta * @param writer - the writer to write into */ private writeDelta; /** * @returns a new writer */ private createDiffWriter; /** * @param line - a line * @returns true if `line` is empty once all colors and padding characters are removed */ isEmpty(line: string): boolean; } export { DiffGenerator };