-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (54 loc) · 1.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const readline = require('readline');
const ncp = require('copy-paste');
const chalk = require('chalk');
const cuss = require('cuss');
const fck = require('./lib/f-ck');
let selectedOption;
const prompt = `${chalk.red('$')} `;
const log = console.log;
const options = '\n1. butt > b*tt\n2. butt > b**t\n3. butt > @#$%\n';
const deprofanitise = str =>
str
.split(' ')
.map(
word =>
word in cuss && cuss[word] >= 1 ? fck[selectedOption](word) : word
)
.join(' ');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Clear the console.
process.stdout.write('\u001b[2J\u001b[0;0H');
rl.question(
`${chalk.black.bgWhite(
'How do you want to clean up your profanities? (e.g "1")\n'
)} ${options}\n${prompt}`,
answer => {
switch (answer) {
case '1':
selectedOption = 'vowel';
break;
case '2':
selectedOption = 'inner';
break;
case '3':
selectedOption = 'grawlix';
break;
default:
selectedOption = 'vowel';
log('That\'s not a valid option, selected "1" for you.');
break;
}
rl.question(
`${chalk.black.bgWhite('Copy or write your input')}\n${prompt}`,
input => {
ncp.copy(deprofanitise(input), () => {
log('✅ Copied result to clipboard.');
process.exit();
});
}
);
}
);