Skip to content

Commit

Permalink
extract strip-ansi dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
njhoffman committed Dec 24, 2021
1 parent 4895ec1 commit 95d9a8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 2 additions & 3 deletions index.js
@@ -1,6 +1,5 @@
"use strict"
const stripAnsi = require('strip-ansi')
const getWCwidth = require('wcwidth')
const stripAnsi = require('./strip-ansi')
const getWCwidth = require('./wcwidth')

const {
padRight,
Expand Down
9 changes: 9 additions & 0 deletions strip-ansi.js
@@ -0,0 +1,9 @@
const ansiRegex = require('ansi-regex');

module.exports = function stripAnsi(string) {
if (typeof string !== 'string') {
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
}

return string.replace(ansiRegex(), '');
}
4 changes: 1 addition & 3 deletions utils.js
@@ -1,6 +1,4 @@
'use strict';

var wcwidth = require('./width');
const wcwidth = require('./wcwidth');

/**
* repeat string `str` up to total length of `len`
Expand Down

0 comments on commit 95d9a8e

Please sign in to comment.