UNPKG

@visulima/string

Version:

Functions for manipulating strings.

47 lines (46 loc) 1.44 kB
/** * Formats ANSI strings for test output. * @param ansiString The ANSI string to format * @returns An object with formatted representations of the string */ declare const formatAnsiString: (ansiString: string) => { ansi: string; json: string; lengthDifference: number; stripped: string; visible: string; }; interface ExpectationResult { actual?: unknown; expected?: unknown; message: () => string; pass: boolean; } /** * Creates an expect matcher that provides detailed information about ANSI string comparison failures. * @param actual The actual ANSI string * @param expected The expected ANSI string * @returns A detailed comparison result */ declare const expectAnsiStrings: (actual: string, expected: string) => ExpectationResult; /** * Compares ANSI strings and returns the differences. * @param actual The actual ANSI string * @param expected The expected ANSI string * @returns Details about the comparison */ declare const compareAnsiStrings: (actual: string, expected: string) => { actual: ReturnType<typeof formatAnsiString>; ansiEqual: boolean; expected: ReturnType<typeof formatAnsiString>; strippedEqual: boolean; summary: { actualLength: number; actualStrippedLength: number; ansiEqual: boolean; expectedLength: number; expectedStrippedLength: number; strippedEqual: boolean; }; }; export { ExpectationResult, compareAnsiStrings, expectAnsiStrings, formatAnsiString };