mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 16:45:22 +00:00
chore: initialize my-pi extension bundle
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export function stripAnsi(text: string): string {
|
||||
return text
|
||||
.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "")
|
||||
.replace(/\x1b\][0-9;]*(?:\x07|\x1b\\)/g, "")
|
||||
.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, "");
|
||||
}
|
||||
|
||||
export function stripAnsiFast(text: string): string {
|
||||
if (!text.includes("\x1b")) {
|
||||
return text;
|
||||
}
|
||||
return stripAnsi(text);
|
||||
}
|
||||
Reference in New Issue
Block a user