forked from Tricked-dev/texter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uwufy.js
43 lines (40 loc) · 1.03 KB
/
uwufy.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
//https://git.holllo.cc/Bauke/owofy/src/branch/main/source/index.js
/**
* The faces owofy will randomly insert at exclamation marks.
*/
const faces = [
'(*^ω^)',
'(◕‿◕✿)',
'(◕ᴥ◕)',
'ʕ•ᴥ•ʔ',
'ʕ→ᴥ←ʔ',
'(*^.^*)',
'owo',
'(。♥‿♥。)',
'uwu',
'(* ̄з ̄)',
'>w<',
'^w^',
'(つ✧ω✧)つ',
'(/ =ω=)/'
];
/**
* Owofies your text! owo
* @param {string} input The input string to owofy.
*/
function owofy(input) {
return input
.replace(/[lr]/g, 'w')
.replace(/[LR]/g, 'W')
.replace(/n([aeiou])/g, 'ny$1')
.replace(/N([aeiou])/g, 'Ny$1')
.replace(/N([AEIOU])/g, 'Ny$1')
.replace(/ove/g, 'uv')
.replace(/!+/g, `! ${faces[Math.floor(Math.random() * faces.length)]}`);
}
// Attach the faces to the owofy function.
// Essentially doing `export const faces ...`.
owofy.faces = faces;
// Export the owofy function as default.
// Essentially doing `export default function owofy ...`.
module.exports = owofy;