UNPKG

cspell

Version:

A Spelling Checker for Code!

45 lines 2.18 kB
export declare function pad(s: string, w: number): string; export declare function padWidth(s: string, target: number): number; export declare function padLeft(s: string, w: number): string; export declare function isAnsiString(s: string): boolean; export declare function width(s: string): number; export declare function ansiWidth(s: string): number; /** * Prune the end of a string to fit within a specified width, adding an ellipsis if necessary. * @param str - the text to prune - ANSI is not supported * @param maxWidth - the maximum width of the text * @param pad - the string to use for padding, default is '…' * @returns the pruned text */ export declare function pruneTextEnd(str: string, maxWidth: number | undefined, pad?: string): string; /** * Prune the start of a string to fit within a specified width, adding an ellipsis if necessary. * @param str - the text to prune - ANSI is not supported * @param maxWidth - the maximum width of the text * @param pad - the string to use for padding, default is '…' * @returns the pruned text */ export declare function pruneTextStart(str: string, maxWidth: number | undefined, pad?: string): string; interface AnsiStrFragment { type: 'text' | 'ansi'; text: string; } export declare function parseAnsiStr(str: string): AnsiStrFragment[]; /** * Prune the end of a string to fit within a specified width, adding an ellipsis if necessary. * @param str - the text to prune - ANSI is supported * @param maxWidth - the maximum width of the text * @param pad - the string to use for padding, default is '…' * @returns the pruned text */ export declare function pruneAnsiTextEnd(str: string, maxWidth: number | undefined, pad?: string): string; /** * Prune the start of a string to fit within a specified width, adding an ellipsis if necessary. * @param str - the text to prune - ANSI is supported * @param maxWidth - the maximum width of the text * @param pad - the string to use for padding, default is '…' * @returns the pruned text */ export declare function pruneAnsiTextStart(str: string, maxWidth: number | undefined, pad?: string): string; export {}; //# sourceMappingURL=pad.d.ts.map