1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports.getRidOfColors = function (str) {
|
10 | return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
11 | };
|
12 |
|
13 |
|
14 | module.exports.getRidOfQuotationMarks = function (str) {
|
15 | return str.replace(/['"]+/g, '');
|
16 | };
|
17 |
|
18 |
|
19 | module.exports.truncate = function (str, maxWidth = 50, truncateMarker = true) {
|
20 | if (truncateMarker) {
|
21 | str = str.length > maxWidth ? str.substring(0, maxWidth) + '...' : str;
|
22 | } else {
|
23 | str = str.length > maxWidth ? str.substring(0, maxWidth) : str;
|
24 | }
|
25 | return str;
|
26 | };
|
27 |
|
28 |
|
29 | module.exports.cleanTagName = function (str) {
|
30 | if (str.includes('semantic')) {
|
31 | let moduleName = str.split('@')[0];
|
32 | return moduleName;
|
33 | }
|
34 | return str;
|
35 | }; |
\ | No newline at end of file |