Skip to content

Commit

Permalink
Cleanup references to strip-ansi
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Sambarino committed Dec 6, 2021
1 parent 84dd5cf commit 30458a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2,302 deletions.
6 changes: 2 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
var stripAnsi = require('strip-ansi');

/**
* Repeats a string.
*
Expand Down Expand Up @@ -81,8 +79,8 @@ exports.options = options;
// see: http://en.wikipedia.org/wiki/ANSI_escape_code
//
exports.strlen = function(str){
str = typeof str === 'string' ? str : String(str);
var stripped = stripAnsi(str);
var code = /\u001b\[(?:\d*;){0,5}\d*m/g;
var stripped = ("" + str).replace(code,'');
var split = stripped.split("\n");
return split.reduce(function (memo, s) { return (s.length > memo) ? s.length : memo }, 0);
}
Loading

0 comments on commit 30458a2

Please sign in to comment.