@socketsecurity/lib
Version:
Core utilities and infrastructure for Socket.dev security tools
30 lines (29 loc) • 989 B
TypeScript
/**
* @fileoverview ANSI escape code utilities.
* Provides constants and helpers for terminal formatting.
*/
// ANSI escape codes - commonly used sequences.
export declare const ANSI_RESET = "\u001B[0m";
export declare const ANSI_BOLD = "\u001B[1m";
export declare const ANSI_DIM = "\u001B[2m";
export declare const ANSI_ITALIC = "\u001B[3m";
export declare const ANSI_UNDERLINE = "\u001B[4m";
export declare const ANSI_STRIKETHROUGH = "\u001B[9m";
/**
* Create a regular expression for matching ANSI escape codes.
*
* Inlined ansi-regex:
* https://socket.dev/npm/package/ansi-regexp/overview/6.2.2
* MIT License
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function ansiRegex(options?: {
onlyFirst?: boolean;
}): RegExp;
/**
* Strip ANSI escape codes from text.
* Uses the inlined ansi-regex for matching.
*/
/*@__NO_SIDE_EFFECTS__*/
export declare function stripAnsi(text: string): string;