index.js 256 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 'use strict'; const stripAnsi = require('strip-ansi'); const charRegex = require('char-regex'); const stringLength = string => { if (string === '') { return 0; } return stripAnsi(string).match(charRegex()).length; }; module.exports = stringLength;