Frontend/25_01_07/mai/node_modules/string-length/index.js
szabomarton 7f4a15b9c3 asd
2025-01-28 11:38:27 +01:00

20 lines
343 B
JavaScript

'use strict';
const stripAnsi = require('strip-ansi');
const charRegex = require('char-regex');
const stringLength = string => {
if (string === '') {
return 0;
}
const strippedString = stripAnsi(string);
if (strippedString === '') {
return 0;
}
return strippedString.match(charRegex()).length;
};
module.exports = stringLength;