forked from npm/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util: put ansiTrim into util from outdated
Credit: @watilde Reviewed-By: @othiym23 Reviewed-By: @iarna PR-URL: npm/npm#14582 Fixes: npm#6756
- Loading branch information
Showing
2 changed files
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function ansiTrim (str) { | ||
var r = new RegExp('\x1b(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|' + | ||
'\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)', 'g') | ||
return str.replace(r, '') | ||
} | ||
|
||
module.exports = ansiTrim |