index.js
 1  'use strict';
 2  const stripAnsi = require('strip-ansi');
 3  const charRegex = require('char-regex');
 4  
 5  const stringLength = string => {
 6  	if (string === '') {
 7  		return 0;
 8  	}
 9  
10  	const strippedString = stripAnsi(string);
11  
12  	if (strippedString === '') {
13  		return 0;
14  	}
15  
16  	return strippedString.match(charRegex()).length;
17  };
18  
19  module.exports = stringLength;