1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | const genId = function genId() {
|
7 | let text = '';
|
8 | const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
9 |
|
10 | for (let i = 0; i < 8; i++) {
|
11 | text += possible.charAt(Math.floor(Math.random() * possible.length));
|
12 | }
|
13 | return text;
|
14 | };
|
15 |
|
16 | const cleanMessage = function cleanMessage(message) {
|
17 | message = message.replace(/\./g, ' ');
|
18 | message = message.replace(/\s,\s/g, ' ');
|
19 |
|
20 | message = message.replace(/([a-zA-Z]),\s/g, '$1 ');
|
21 | message = message.replace(/"(.*)"/g, '$1');
|
22 | message = message.replace(/\s"\s?/g, ' ');
|
23 | message = message.replace(/\s'\s?/g, ' ');
|
24 | message = message.replace(/\s?!\s?/g, ' ');
|
25 | message = message.replace(/\?\s?/g, ' ');
|
26 | return message;
|
27 | };
|
28 |
|
29 | exports.default = { cleanMessage, genId }; |
\ | No newline at end of file |