|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
343 bytes
|
| Line | |
|---|
| 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;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.