#28: prettier formatting

This commit is contained in:
tsomic
2023-03-02 23:47:28 +01:00
parent d001292572
commit 347878666e
64 changed files with 5762 additions and 1947 deletions
+30 -30
View File
@@ -4,33 +4,33 @@
**Possible text generations and their parameters:**
- _Australia_ for **ʇxǝʇ uʍop ǝpᴉsdn**
- _reverse_: boolean - whether or not to translate **from** or **to** _Australia_
- _Bold_ for **𝗕𝗼𝗹𝗱** text
- _Braille_ for **⠃⠗⠁⠊⠇⠇⠑⠼**
- _reverse_: boolean - whether or not to translate **from** or **to** _Braille_
- _Cummy_ for just the same text
- _Emoji_ for **more 📈😤 emotions 😍**
- _maxEmojis_: number - maximum number of emojis after a word
- _Fancy_ for **𝒶 𝓃𝒾𝒸ℯ 𝒾𝓉𝒶𝓁𝒾𝒸 𝒻ℴ𝓃𝓉**
- _Fraktur_ for **𝔱𝔥𝔦𝔰 𝔬𝔩𝔡 𝔊𝔢𝔯𝔪𝔞𝔫 𝔣𝔬𝔫𝔱**
- _bold_: boolean - 𝖇𝖔𝖑𝖉 or 𝔫𝔬𝔱 𝔟𝔬𝔩𝔡
- _Italic_ for **𝘴𝘭𝘢𝘯𝘵𝘦𝘥 𝘵𝘦𝘹𝘵**
- _Leet_ for **13375p34k**
- _advanced_: boolean - a more advanced leetspeak for the most elite of the elitists
- _reverse_: boolean - whether or not to translate **from** or **to** _Leet_
- _Mirror_ for **ɈxɘɈ bɘɿoɿɿiM**
- _reverse_: boolean - whether or not to translate **from** or **to** _Mirror_
- _Mock_ for **ThE MoCkInG SpOnGeBoB MeMe tExT**
- _startLowerCase_: boolean - start with a lowercase or an uppercase letter
- _Morse_ for **-- --- .-. ... . -.-. --- -.. .**
- _reverse_: boolean - whether or not to translate **from** or **to** _Morse_
- _Ogre_ for **Meddl Loide**
- _owo_ for **aww youw owo nyeeds**
- _nuzzle_: boolean - add **schmiegt an** to the end of the text. More language support to come.
- _Strikethrough_ for **s̶t̶r̶u̶c̶k̶ ̶t̶h̶r̶o̶u̶g̶h̶** text
- _Tiny_ for **ᵛᵉʳʸ ˢᵐᵃˡˡ ᵗᵉˣᵗ**
- _Translate_ for **bad texts have been translated**
- _numberTranslations_: number - number of languages the text is being translated to before translating back to German. More language support to come.
- _Zalgo_ for **ơ̬͌ḫ̭͐ ͇͓ͥl̻̏͢o̶̥̜r͌͛́d̼̉͢ ͔̆͘h̹̑͝e͙̲ͅl͇̮͘p͍̔̊ ̳̆͠m̼̉̎e̞̞̊ ͍̈̒h̳̫̐ë̴̦ ͚̋͘c̮̟ͯo͌͒̍m̷̀͝e̩͕͂s̩̲̅**
- _intensity_: number - value from _0_ to _100_ to define, you guessed it, the intensity of the zalgo
- _Australia_ for **ʇxǝʇ uʍop ǝpᴉsdn**
- _reverse_: boolean - whether or not to translate **from** or **to** _Australia_
- _Bold_ for **𝗕𝗼𝗹𝗱** text
- _Braille_ for **⠃⠗⠁⠊⠇⠇⠑⠼**
- _reverse_: boolean - whether or not to translate **from** or **to** _Braille_
- _Cummy_ for just the same text
- _Emoji_ for **more 📈😤 emotions 😍**
- _maxEmojis_: number - maximum number of emojis after a word
- _Fancy_ for **𝒶 𝓃𝒾𝒸ℯ 𝒾𝓉𝒶𝓁𝒾𝒸 𝒻ℴ𝓃𝓉**
- _Fraktur_ for **𝔱𝔥𝔦𝔰 𝔬𝔩𝔡 𝔊𝔢𝔯𝔪𝔞𝔫 𝔣𝔬𝔫𝔱**
- _bold_: boolean - 𝖇𝖔𝖑𝖉 or 𝔫𝔬𝔱 𝔟𝔬𝔩𝔡
- _Italic_ for **𝘴𝘭𝘢𝘯𝘵𝘦𝘥 𝘵𝘦𝘹𝘵**
- _Leet_ for **13375p34k**
- _advanced_: boolean - a more advanced leetspeak for the most elite of the elitists
- _reverse_: boolean - whether or not to translate **from** or **to** _Leet_
- _Mirror_ for **ɈxɘɈ bɘɿoɿɿiM**
- _reverse_: boolean - whether or not to translate **from** or **to** _Mirror_
- _Mock_ for **ThE MoCkInG SpOnGeBoB MeMe tExT**
- _startLowerCase_: boolean - start with a lowercase or an uppercase letter
- _Morse_ for **-- --- .-. ... . -.-. --- -.. .**
- _reverse_: boolean - whether or not to translate **from** or **to** _Morse_
- _Ogre_ for **Meddl Loide**
- _owo_ for **aww youw owo nyeeds**
- _nuzzle_: boolean - add **schmiegt an** to the end of the text. More language support to come.
- _Strikethrough_ for **s̶t̶r̶u̶c̶k̶ ̶t̶h̶r̶o̶u̶g̶h̶** text
- _Tiny_ for **ᵛᵉʳʸ ˢᵐᵃˡˡ ᵗᵉˣᵗ**
- _Translate_ for **bad texts have been translated**
- _numberTranslations_: number - number of languages the text is being translated to before translating back to German. More language support to come.
- _Zalgo_ for **ơ̬͌ḫ̭͐ ͇͓ͥl̻̏͢o̶̥̜r͌͛́d̼̉͢ ͔̆͘h̹̑͝e͙̲ͅl͇̮͘p͍̔̊ ̳̆͠m̼̉̎e̞̞̊ ͍̈̒h̳̫̐ë̴̦ ͚̋͘c̮̟ͯo͌͒̍m̷̀͝e̩͕͂s̩̲̅**
- _intensity_: number - value from _0_ to _100_ to define, you guessed it, the intensity of the zalgo
+41 -41
View File
@@ -1,43 +1,43 @@
{
"name": "text-modifier-rest",
"version": "1.0.0",
"description": "Rest-Services for various text generations",
"main": "server.js",
"scripts": {
"build": "tsc && npm run transform-emoji-map",
"debug": "npm run build && npm run watch-debug",
"serve-debug": "nodemon --inspect dist/server.js DEBUG",
"serve": "node dist/server.js",
"start": "npm run serve",
"watch-debug": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve-debug\"",
"watch-node": "nodemon dist/server.js",
"watch-ts": "tsc -w",
"watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run watch-node\"",
"transform-emoji-map": "node src/buildScripts/transformEmojiMap/transformEmojiMap.js"
},
"repository": {
"type": "git",
"url": "https://github.com/StarAppeal/rest-text-manipulator"
},
"author": "tsomic, starappeal",
"license": "MIT",
"dependencies": {
"braille": "^1.1.0",
"concurrently": "^6.5.1",
"express": "^4.18.2",
"nodemon": "^2.0.15",
"string-similarity": "^4.0.4",
"translatte": "^3.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},
"devDependencies": {
"@tsconfig/node12": "^1.0.9",
"@types/express": "^4.17.13",
"@types/node": "^17.0.6",
"@types/string-similarity": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"prettier": "^2.8.4"
}
"name": "text-modifier-rest",
"version": "1.0.0",
"description": "Rest-Services for various text generations",
"main": "server.js",
"scripts": {
"build": "tsc && npm run transform-emoji-map",
"debug": "npm run build && npm run watch-debug",
"serve-debug": "nodemon --inspect dist/server.js DEBUG",
"serve": "node dist/server.js",
"start": "npm run serve",
"watch-debug": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve-debug\"",
"watch-node": "nodemon dist/server.js",
"watch-ts": "tsc -w",
"watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run watch-node\"",
"transform-emoji-map": "node src/buildScripts/transformEmojiMap/transformEmojiMap.js"
},
"repository": {
"type": "git",
"url": "https://github.com/StarAppeal/rest-text-manipulator"
},
"author": "tsomic, starappeal",
"license": "MIT",
"dependencies": {
"braille": "^1.1.0",
"concurrently": "^6.5.1",
"express": "^4.18.2",
"nodemon": "^2.0.15",
"string-similarity": "^4.0.4",
"translatte": "^3.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},
"devDependencies": {
"@tsconfig/node12": "^1.0.9",
"@types/express": "^4.17.13",
"@types/node": "^17.0.6",
"@types/string-similarity": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"prettier": "^2.8.4"
}
}
+14 -14
View File
@@ -1,19 +1,19 @@
import express from "express";
import modifiers from "./routes/modifiers";
import express from 'express'
import modifiers from './routes/modifiers'
const application = express();
const application = express()
application.use((_req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "GET,POST");
res.header(
"Access-Control-Allow-Headers",
"Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers"
);
next();
});
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,POST')
res.header(
'Access-Control-Allow-Headers',
'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers'
)
next()
})
application.use(express.json());
application.use("/modifiers", modifiers);
application.use(express.json())
application.use('/modifiers', modifiers)
export default application;
export default application
@@ -1,32 +1,32 @@
const fs = require("fs");
const FILE_PREFIX = "const emoji = ";
const FILE_SUFFIX = ";export default emoji;";
const fs = require('fs')
const FILE_PREFIX = 'const emoji = '
const FILE_SUFFIX = ';export default emoji;'
const INPUT_FILE = "src/buildScripts/transformEmojiMap/emojiMap.json";
const OUTPUT_FILE = "src/constants/maps/emoji.ts";
const INPUT_FILE = 'src/buildScripts/transformEmojiMap/emojiMap.json'
const OUTPUT_FILE = 'src/constants/maps/emoji.ts'
console.log("inputFile: " + INPUT_FILE);
console.log("outputFile: " + OUTPUT_FILE);
console.log('inputFile: ' + INPUT_FILE)
console.log('outputFile: ' + OUTPUT_FILE)
console.log("Reading inputfile...");
let content = JSON.parse(fs.readFileSync(INPUT_FILE, "utf8"));
console.log('Reading inputfile...')
let content = JSON.parse(fs.readFileSync(INPUT_FILE, 'utf8'))
console.log("transforming to correct syntax...");
let result = transform(content);
console.log('transforming to correct syntax...')
let result = transform(content)
console.log("writing file");
console.log('writing file')
fs.writeFileSync(
OUTPUT_FILE,
[FILE_PREFIX, JSON.stringify(result), FILE_SUFFIX].join("")
);
OUTPUT_FILE,
[FILE_PREFIX, JSON.stringify(result), FILE_SUFFIX].join('')
)
function transform(input) {
const result = {};
for (const [key] of Object.entries(input)) {
const keys = key.split(",");
keys.forEach((isolatedKey) => {
result[isolatedKey] = input[key].concat(result[isolatedKey] || []);
});
}
return result;
const result = {}
for (const [key] of Object.entries(input)) {
const keys = key.split(',')
keys.forEach((isolatedKey) => {
result[isolatedKey] = input[key].concat(result[isolatedKey] || [])
})
}
return result
}
+3 -3
View File
@@ -1,6 +1,6 @@
enum ParamType {
BOOLEAN,
NUMBER,
BOOLEAN,
NUMBER,
}
export default ParamType;
export default ParamType
+5 -5
View File
@@ -1,11 +1,11 @@
interface LinkInstance {
index: number;
length: number;
index: number
length: number
}
interface LinkExtraction {
textParts: string[];
extractedLinks: string[];
textParts: string[]
extractedLinks: string[]
}
export { LinkInstance, LinkExtraction };
export { LinkInstance, LinkExtraction }
+8 -8
View File
@@ -1,12 +1,12 @@
import ModifierRequest from "./ModifierRequest";
import Param from "./Param";
import ModifierRequest from './ModifierRequest'
import Param from './Param'
interface ModifierConfig {
function: (request: ModifierRequest) => string | Promise<string>;
label: string;
value: string;
hidden?: boolean;
params?: Param[];
function: (request: ModifierRequest) => string | Promise<string>
label: string
value: string
hidden?: boolean
params?: Param[]
}
export default ModifierConfig;
export default ModifierConfig
+3 -3
View File
@@ -1,6 +1,6 @@
interface ModifierRequest {
text: string;
params?: Record<string, boolean | number>;
text: string
params?: Record<string, boolean | number>
}
export default ModifierRequest;
export default ModifierRequest
+3 -3
View File
@@ -1,6 +1,6 @@
interface ModifierRequest {
text: string;
time: number;
text: string
time: number
}
export default ModifierRequest;
export default ModifierRequest
+5 -5
View File
@@ -1,9 +1,9 @@
import ParamType from "../enums/ParamType";
import ParamType from '../enums/ParamType'
interface Param {
label: string;
value: string;
type: ParamType;
label: string
value: string
type: ParamType
}
export default Param;
export default Param
+55 -55
View File
@@ -1,57 +1,57 @@
const australia = {
A: "∀",
B: "ꓭ",
C: "Ɔ",
D: "ꓷ",
E: "Ǝ",
F: "Ⅎ",
G: "ꓨ",
J: "ſ",
K: "ꓘ",
L: "˥",
M: "W",
P: "Ԁ",
Q: "Ꝺ",
R: "ᴚ",
T: "┴",
U: "∩",
V: "Λ",
W: "M",
Y: "⅄",
a: "ɐ",
b: "q",
c: "ɔ",
d: "p",
e: "ǝ",
f: "ɟ",
g: "ɓ",
h: "ɥ",
i: "ᴉ",
j: "ɾ",
k: "ʞ",
m: "ɯ",
n: "u",
p: "d",
q: "b",
r: "ɹ",
t: "ʇ",
u: "n",
v: "ʌ",
w: "ʍ",
y: "ʎ",
Ä: "Ǝ∀",
Ö: "O̤",
Ü: "Ǝ∩",
ä: "ɐ̤",
ö: "o̤",
ü: "n̤",
ß: "ss",
: "SS",
"?": "¿",
"!": "¡",
".": "˙",
"<": ">",
">": "<",
};
A: '∀',
B: 'ꓭ',
C: 'Ɔ',
D: 'ꓷ',
E: 'Ǝ',
F: 'Ⅎ',
G: 'ꓨ',
J: 'ſ',
K: 'ꓘ',
L: '˥',
M: 'W',
P: 'Ԁ',
Q: 'Ꝺ',
R: 'ᴚ',
T: '┴',
U: '∩',
V: 'Λ',
W: 'M',
Y: '⅄',
a: 'ɐ',
b: 'q',
c: 'ɔ',
d: 'p',
e: 'ǝ',
f: 'ɟ',
g: 'ɓ',
h: 'ɥ',
i: 'ᴉ',
j: 'ɾ',
k: 'ʞ',
m: 'ɯ',
n: 'u',
p: 'd',
q: 'b',
r: 'ɹ',
t: 'ʇ',
u: 'n',
v: 'ʌ',
w: 'ʍ',
y: 'ʎ',
Ä: 'Ǝ∀',
Ö: 'O̤',
Ü: 'Ǝ∩',
ä: 'ɐ̤',
ö: 'o̤',
ü: 'n̤',
ß: 'ss',
: 'SS',
'?': '¿',
'!': '¡',
'.': '˙',
'<': '>',
'>': '<',
}
export default australia;
export default australia
+68 -69
View File
@@ -1,70 +1,69 @@
const bold = {
a: "𝗮",
b: "𝗯",
c: "𝗰",
d: "𝗱",
e: "𝗲",
f: "𝗳",
g: "𝗴",
h: "𝗵",
i: "𝗶",
j: "𝗷",
k: "𝗸",
l: "𝗹",
m: "𝗺",
n: "𝗻",
o: "𝗼",
p: "𝗽",
q: "𝗾",
r: "𝗿",
s: "𝘀",
t: "𝘁",
u: "𝘂",
v: "𝘃",
w: "𝘄",
x: "𝘅",
y: "𝘆",
z: "𝘇",
ä: "𝗮̈",
ö: "𝗼̈",
ü: "𝘂̈",
A: "𝗔",
B: "𝗕",
C: "𝗖",
D: "𝗗",
E: "𝗘",
F: "𝗙",
G: "𝗚",
H: "𝗛",
I: "𝗜",
J: "𝗝",
K: "𝗞",
L: "𝗟",
M: "𝗠",
N: "𝗡",
O: "𝗢",
P: "𝗣",
Q: "𝗤",
R: "𝗥",
S: "𝗦",
T: "𝗧",
U: "𝗨",
V: "𝗩",
W: "𝗪",
X: "𝗫",
Y: "𝗬",
Z: "𝗭",
1: "𝟭",
2: "𝟮",
3: "𝟯",
4: "𝟰",
5: "𝟱",
6: "𝟲",
7: "𝟳",
8: "𝟴",
9: "𝟵",
0: "𝟬",
};
export default bold;
a: '𝗮',
b: '𝗯',
c: '𝗰',
d: '𝗱',
e: '𝗲',
f: '𝗳',
g: '𝗴',
h: '𝗵',
i: '𝗶',
j: '𝗷',
k: '𝗸',
l: '𝗹',
m: '𝗺',
n: '𝗻',
o: '𝗼',
p: '𝗽',
q: '𝗾',
r: '𝗿',
s: '𝘀',
t: '𝘁',
u: '𝘂',
v: '𝘃',
w: '𝘄',
x: '𝘅',
y: '𝘆',
z: '𝘇',
ä: '𝗮̈',
ö: '𝗼̈',
ü: '𝘂̈',
A: '𝗔',
B: '𝗕',
C: '𝗖',
D: '𝗗',
E: '𝗘',
F: '𝗙',
G: '𝗚',
H: '𝗛',
I: '𝗜',
J: '𝗝',
K: '𝗞',
L: '𝗟',
M: '𝗠',
N: '𝗡',
O: '𝗢',
P: '𝗣',
Q: '𝗤',
R: '𝗥',
S: '𝗦',
T: '𝗧',
U: '𝗨',
V: '𝗩',
W: '𝗪',
X: '𝗫',
Y: '𝗬',
Z: '𝗭',
1: '𝟭',
2: '𝟮',
3: '𝟯',
4: '𝟰',
5: '𝟱',
6: '𝟲',
7: '𝟳',
8: '𝟴',
9: '𝟵',
0: '𝟬',
}
export default bold
File diff suppressed because one or more lines are too long
+62 -62
View File
@@ -1,64 +1,64 @@
const fancy = {
A: "𝒜",
B: "",
C: "𝒞",
D: "𝒟",
E: "",
F: "",
G: "𝒢",
H: "",
I: "",
J: "𝒥",
K: "𝒦",
L: "",
M: "",
N: "𝒩",
O: "𝒪",
P: "𝒫",
Q: "𝒬",
R: "",
S: "𝒮",
T: "𝒯",
U: "𝒰",
V: "𝒱",
W: "𝒲",
X: "𝒳",
Y: "𝒴",
Z: "𝒵",
a: "𝒶",
b: "𝒷",
c: "𝒸",
d: "𝒹",
e: "",
f: "𝒻",
g: "",
h: "𝒽",
i: "𝒾",
j: "𝒿",
k: "𝓀",
l: "𝓁",
m: "𝓂",
n: "𝓃",
o: "",
p: "𝓅",
q: "𝓆",
r: "𝓇",
s: "𝓈",
t: "𝓉",
u: "𝓊",
v: "𝓋",
w: "𝓌",
x: "𝓍",
y: "𝓎",
z: "𝓏",
ä: "𝒶̈",
ö: "𝑜̈",
ü: "𝓊̈",
Ä: "𝒜ℰ",
Ö: "𝒪ℰ",
Ü: "𝒰ℰ",
ß: "𝓈𝓈",
: "𝒮𝒮",
};
A: '𝒜',
B: '',
C: '𝒞',
D: '𝒟',
E: '',
F: '',
G: '𝒢',
H: '',
I: '',
J: '𝒥',
K: '𝒦',
L: '',
M: '',
N: '𝒩',
O: '𝒪',
P: '𝒫',
Q: '𝒬',
R: '',
S: '𝒮',
T: '𝒯',
U: '𝒰',
V: '𝒱',
W: '𝒲',
X: '𝒳',
Y: '𝒴',
Z: '𝒵',
a: '𝒶',
b: '𝒷',
c: '𝒸',
d: '𝒹',
e: '',
f: '𝒻',
g: '',
h: '𝒽',
i: '𝒾',
j: '𝒿',
k: '𝓀',
l: '𝓁',
m: '𝓂',
n: '𝓃',
o: '',
p: '𝓅',
q: '𝓆',
r: '𝓇',
s: '𝓈',
t: '𝓉',
u: '𝓊',
v: '𝓋',
w: '𝓌',
x: '𝓍',
y: '𝓎',
z: '𝓏',
ä: '𝒶̈',
ö: '𝑜̈',
ü: '𝓊̈',
Ä: '𝒜ℰ',
Ö: '𝒪ℰ',
Ü: '𝒰ℰ',
ß: '𝓈𝓈',
: '𝒮𝒮',
}
export default fancy;
export default fancy
+123 -123
View File
@@ -1,127 +1,127 @@
const fraktur = {
A: "𝔄",
B: "𝔅",
C: "",
D: "𝔇",
E: "𝔈",
F: "𝔉",
G: "𝔊",
H: "",
I: "",
J: "𝔍",
K: "𝔎",
L: "𝔏",
M: "𝔐",
N: "𝔑",
O: "𝔒",
P: "𝔓",
Q: "𝔔",
R: "",
S: "𝔖",
T: "𝔗",
U: "𝔘",
V: "𝔙",
W: "𝔚",
X: "𝔛",
Y: "𝔜",
Z: "",
a: "𝔞",
b: "𝔟",
c: "𝔠",
d: "𝔡",
e: "𝔢",
f: "𝔣",
g: "𝔤",
h: "𝔥",
i: "𝔦",
j: "𝔧",
k: "𝔨",
l: "𝔩",
m: "𝔪",
n: "𝔫",
o: "𝔬",
p: "𝔭",
q: "𝔮",
r: "𝔯",
s: "𝔰",
t: "𝔱",
u: "𝔲",
v: "𝔳",
w: "𝔴",
x: "𝔵",
y: "𝔶",
z: "𝔷",
ä: "𝔞̈",
ö: "𝔬̈",
ü: "𝔲̈",
Ä: "𝔄𝔈",
Ö: "𝔒𝔈",
Ü: "𝔘𝔈",
ß: "𝔰𝔰",
: "𝔖𝔖",
};
A: '𝔄',
B: '𝔅',
C: '',
D: '𝔇',
E: '𝔈',
F: '𝔉',
G: '𝔊',
H: '',
I: '',
J: '𝔍',
K: '𝔎',
L: '𝔏',
M: '𝔐',
N: '𝔑',
O: '𝔒',
P: '𝔓',
Q: '𝔔',
R: '',
S: '𝔖',
T: '𝔗',
U: '𝔘',
V: '𝔙',
W: '𝔚',
X: '𝔛',
Y: '𝔜',
Z: '',
a: '𝔞',
b: '𝔟',
c: '𝔠',
d: '𝔡',
e: '𝔢',
f: '𝔣',
g: '𝔤',
h: '𝔥',
i: '𝔦',
j: '𝔧',
k: '𝔨',
l: '𝔩',
m: '𝔪',
n: '𝔫',
o: '𝔬',
p: '𝔭',
q: '𝔮',
r: '𝔯',
s: '𝔰',
t: '𝔱',
u: '𝔲',
v: '𝔳',
w: '𝔴',
x: '𝔵',
y: '𝔶',
z: '𝔷',
ä: '𝔞̈',
ö: '𝔬̈',
ü: '𝔲̈',
Ä: '𝔄𝔈',
Ö: '𝔒𝔈',
Ü: '𝔘𝔈',
ß: '𝔰𝔰',
: '𝔖𝔖',
}
const frakturBold = {
A: "𝕬",
B: "𝕭",
C: "𝕮",
D: "𝕯",
E: "𝕰",
F: "𝕱",
G: "𝕲",
H: "𝕳",
I: "𝕴",
J: "𝕵",
K: "𝕶",
L: "𝕷",
M: "𝕸",
N: "𝕹",
O: "𝕺",
P: "𝕻",
Q: "𝕼",
R: "𝕽",
S: "𝕾",
T: "𝕿",
U: "𝖀",
V: "𝖁",
W: "𝖂",
X: "𝖃",
Y: "𝖄",
Z: "𝖅",
a: "𝖆",
b: "𝖇",
c: "𝖈",
d: "𝖉",
e: "𝖊",
f: "𝖋",
g: "𝖌",
h: "𝖍",
i: "𝖎",
j: "𝖏",
k: "𝖐",
l: "𝖑",
m: "𝖒",
n: "𝖓",
o: "𝖔",
p: "𝖕",
q: "𝖖",
r: "𝖗",
s: "𝖘",
t: "𝖙",
u: "𝖚",
v: "𝖛",
w: "𝖜",
x: "𝖝",
y: "𝖞",
z: "𝖟",
ä: "𝖆̈",
ö: "𝖔̈",
ü: "𝖚̈",
Ä: "𝕬𝕮",
Ö: "𝕺𝕮",
Ü: "𝖀𝕮",
ß: "𝖘𝖘",
: "𝕾𝕾",
};
A: '𝕬',
B: '𝕭',
C: '𝕮',
D: '𝕯',
E: '𝕰',
F: '𝕱',
G: '𝕲',
H: '𝕳',
I: '𝕴',
J: '𝕵',
K: '𝕶',
L: '𝕷',
M: '𝕸',
N: '𝕹',
O: '𝕺',
P: '𝕻',
Q: '𝕼',
R: '𝕽',
S: '𝕾',
T: '𝕿',
U: '𝖀',
V: '𝖁',
W: '𝖂',
X: '𝖃',
Y: '𝖄',
Z: '𝖅',
a: '𝖆',
b: '𝖇',
c: '𝖈',
d: '𝖉',
e: '𝖊',
f: '𝖋',
g: '𝖌',
h: '𝖍',
i: '𝖎',
j: '𝖏',
k: '𝖐',
l: '𝖑',
m: '𝖒',
n: '𝖓',
o: '𝖔',
p: '𝖕',
q: '𝖖',
r: '𝖗',
s: '𝖘',
t: '𝖙',
u: '𝖚',
v: '𝖛',
w: '𝖜',
x: '𝖝',
y: '𝖞',
z: '𝖟',
ä: '𝖆̈',
ö: '𝖔̈',
ü: '𝖚̈',
Ä: '𝕬𝕮',
Ö: '𝕺𝕮',
Ü: '𝖀𝕮',
ß: '𝖘𝖘',
: '𝕾𝕾',
}
export { fraktur, frakturBold };
export { fraktur, frakturBold }
+62 -62
View File
@@ -1,64 +1,64 @@
const italic = {
A: "𝘈",
B: "𝘉",
C: "𝘊",
D: "𝘋",
E: "𝘌",
F: "𝘍",
G: "𝘎",
H: "𝘏",
I: "𝘐",
J: "𝘑",
K: "𝘒",
L: "𝘓",
M: "𝘔",
N: "𝘕",
O: "𝘖",
P: "𝘗",
Q: "𝘘",
R: "𝘙",
S: "𝘚",
T: "𝘛",
U: "𝘜",
V: "𝘝",
W: "𝘞",
X: "𝘟",
Y: "𝘠",
Z: "𝘡",
a: "𝘢",
b: "𝘣",
c: "𝘤",
d: "𝘥",
e: "𝘦",
f: "𝘧",
g: "𝘨",
h: "𝘩",
i: "𝘪",
j: "𝘫",
k: "𝘬",
l: "𝘭",
m: "𝘮",
n: "𝘯",
o: "𝘰",
p: "𝘱",
q: "𝘲",
r: "𝘳",
s: "𝘴",
t: "𝘵",
u: "𝘶",
v: "𝘷",
w: "𝘸",
x: "𝘹",
y: "𝘺",
z: "𝘻",
ä: "𝘢𝘦",
ö: "𝘰𝘦",
ü: "𝘶𝘦",
Ä: "𝘈𝘌",
Ö: "𝘖𝘌",
Ü: "𝘜𝘌",
ß: "𝘴𝘴",
: "𝘚𝘚",
};
A: '𝘈',
B: '𝘉',
C: '𝘊',
D: '𝘋',
E: '𝘌',
F: '𝘍',
G: '𝘎',
H: '𝘏',
I: '𝘐',
J: '𝘑',
K: '𝘒',
L: '𝘓',
M: '𝘔',
N: '𝘕',
O: '𝘖',
P: '𝘗',
Q: '𝘘',
R: '𝘙',
S: '𝘚',
T: '𝘛',
U: '𝘜',
V: '𝘝',
W: '𝘞',
X: '𝘟',
Y: '𝘠',
Z: '𝘡',
a: '𝘢',
b: '𝘣',
c: '𝘤',
d: '𝘥',
e: '𝘦',
f: '𝘧',
g: '𝘨',
h: '𝘩',
i: '𝘪',
j: '𝘫',
k: '𝘬',
l: '𝘭',
m: '𝘮',
n: '𝘯',
o: '𝘰',
p: '𝘱',
q: '𝘲',
r: '𝘳',
s: '𝘴',
t: '𝘵',
u: '𝘶',
v: '𝘷',
w: '𝘸',
x: '𝘹',
y: '𝘺',
z: '𝘻',
ä: '𝘢𝘦',
ö: '𝘰𝘦',
ü: '𝘶𝘦',
Ä: '𝘈𝘌',
Ö: '𝘖𝘌',
Ü: '𝘜𝘌',
ß: '𝘴𝘴',
: '𝘚𝘚',
}
export default italic;
export default italic
+48 -48
View File
@@ -1,54 +1,54 @@
const alphabetBasic = {
a: "4",
b: "8",
e: "3",
f: "ph",
g: "6",
l: "1",
o: "0",
s: "5",
t: "7",
};
a: '4',
b: '8',
e: '3',
f: 'ph',
g: '6',
l: '1',
o: '0',
s: '5',
t: '7',
}
const alphabetAdvanced = {
c: "(", // or k or |< or /<
d: "<|",
h: "|-|",
k: "|<", // or /<
l: "|",
m: "|\\/|",
n: "|\\|",
p: "|2",
u: "|_|",
v: "\\/", // or \/
w: "\\/\\/", // or \/\/
x: "><",
y: "'/",
};
c: '(', // or k or |< or /<
d: '<|',
h: '|-|',
k: '|<', // or /<
l: '|',
m: '|\\/|',
n: '|\\|',
p: '|2',
u: '|_|',
v: '\\/', // or \/
w: '\\/\\/', // or \/\/
x: '><',
y: "'/",
}
const alphabetReversed = [
[/(\|\\\/\|)/g, "m"],
[/(\|\\\|)/g, "n"],
[/(\()/g, "c"],
[/(<\|)/g, "d"],
[/\|-\|/g, "h"],
[/(\|<)/g, "k"],
[/(\|2)/g, "p"],
[/(\|_\|)/g, "u"],
[/(\/\/)/g, "w"],
[/(><)/g, "x"],
[/(\|)/g, "l"],
[/(\'\/)/g, "y"],
[/(\/)/g, "v"],
[/(1)/g, "l"],
[/(0)/g, "o"],
[/(3)/g, "e"],
[/(4)/g, "a"],
[/(5)/g, "s"],
[/(6)/g, "g"],
[/(7)/g, "t"],
[/(8)/g, "b"],
[/(ph)/g, "f"],
];
[/(\|\\\/\|)/g, 'm'],
[/(\|\\\|)/g, 'n'],
[/(\()/g, 'c'],
[/(<\|)/g, 'd'],
[/\|-\|/g, 'h'],
[/(\|<)/g, 'k'],
[/(\|2)/g, 'p'],
[/(\|_\|)/g, 'u'],
[/(\/\/)/g, 'w'],
[/(><)/g, 'x'],
[/(\|)/g, 'l'],
[/(\'\/)/g, 'y'],
[/(\/)/g, 'v'],
[/(1)/g, 'l'],
[/(0)/g, 'o'],
[/(3)/g, 'e'],
[/(4)/g, 'a'],
[/(5)/g, 's'],
[/(6)/g, 'g'],
[/(7)/g, 't'],
[/(8)/g, 'b'],
[/(ph)/g, 'f'],
]
export { alphabetBasic, alphabetAdvanced, alphabetReversed };
export { alphabetBasic, alphabetAdvanced, alphabetReversed }
+36 -36
View File
@@ -1,38 +1,38 @@
const mirror = {
B: "ꓭ",
C: "Ɔ",
D: "ꓷ",
E: "Ǝ",
F: "ᖷ",
G: "Ә",
J: "Ⴑ",
K: "ꓘ",
L: "⅃",
N: "И",
P: "ꟼ",
Q: "Ϙ",
R: "Я",
S: "Ƨ",
a: "ɒ",
b: "d",
c: "ɔ",
d: "b",
e: "ɘ",
f: "ʇ",
g: "ϱ",
k: "ʞ",
p: "q",
q: "p",
r: "ɿ",
s: "ƨ",
t: "Ɉ",
y: "γ",
ä: "ɒ̈",
ß: "ƨƨ",
: "ƧƧ",
"?": "⸮",
"<": ">",
">": "<",
};
B: 'ꓭ',
C: 'Ɔ',
D: 'ꓷ',
E: 'Ǝ',
F: 'ᖷ',
G: 'Ә',
J: 'Ⴑ',
K: 'ꓘ',
L: '⅃',
N: 'И',
P: 'ꟼ',
Q: 'Ϙ',
R: 'Я',
S: 'Ƨ',
a: 'ɒ',
b: 'd',
c: 'ɔ',
d: 'b',
e: 'ɘ',
f: 'ʇ',
g: 'ϱ',
k: 'ʞ',
p: 'q',
q: 'p',
r: 'ɿ',
s: 'ƨ',
t: 'Ɉ',
y: 'γ',
ä: 'ɒ̈',
ß: 'ƨƨ',
: 'ƧƧ',
'?': '⸮',
'<': '>',
'>': '<',
}
export default mirror;
export default mirror
+59 -59
View File
@@ -1,61 +1,61 @@
const morseCode = {
a: ".-",
b: "-...",
c: "-.-.",
d: "-..",
e: ".",
f: "..-.",
g: "--.",
h: "....",
i: "..",
j: ".---",
k: "-.-",
l: ".-..",
m: "--",
n: "-.",
o: "---",
p: ".--.",
q: "--.-",
r: ".-.",
s: "...",
t: "-",
u: "..-",
v: "...-",
w: ".--",
x: "-..-",
y: "-.--",
z: "--..",
ä: ".-.-",
ö: "---.",
ü: "..--",
ß: "...--..",
"1": ".----",
"2": "..---",
"3": "...--",
"4": "....-",
"5": ".....",
"6": "-....",
"7": "--...",
"8": "---..",
"9": "----.",
"0": "-----",
".": ".-.-.-",
",": "--..--",
":": "---...",
";": ".-.-.-",
"?": "..--..",
"!": "-.-.--",
"-": "-....-",
_: "..--.-,",
"(": "-.--.",
")": "-.--.-",
"'": ".----.",
'"': ".-..-.",
"„": ".-..-.",
"=": "-...-",
"+": ".-.-.",
"/": "-..-.",
"@": ".--.-.",
};
a: '.-',
b: '-...',
c: '-.-.',
d: '-..',
e: '.',
f: '..-.',
g: '--.',
h: '....',
i: '..',
j: '.---',
k: '-.-',
l: '.-..',
m: '--',
n: '-.',
o: '---',
p: '.--.',
q: '--.-',
r: '.-.',
s: '...',
t: '-',
u: '..-',
v: '...-',
w: '.--',
x: '-..-',
y: '-.--',
z: '--..',
ä: '.-.-',
ö: '---.',
ü: '..--',
ß: '...--..',
'1': '.----',
'2': '..---',
'3': '...--',
'4': '....-',
'5': '.....',
'6': '-....',
'7': '--...',
'8': '---..',
'9': '----.',
'0': '-----',
'.': '.-.-.-',
',': '--..--',
':': '---...',
';': '.-.-.-',
'?': '..--..',
'!': '-.-.--',
'-': '-....-',
_: '..--.-,',
'(': '-.--.',
')': '-.--.-',
"'": '.----.',
'"': '.-..-.',
'„': '.-..-.',
'=': '-...-',
'+': '.-.-.',
'/': '-..-.',
'@': '.--.-.',
}
export default morseCode;
export default morseCode
+582 -582
View File
File diff suppressed because it is too large Load Diff
+34 -34
View File
@@ -1,36 +1,36 @@
const tiny = {
a: "ᵃ",
b: "ᵇ",
c: "ᶜ",
d: "ᵈ",
e: "ᵉ",
f: "ᶠ",
g: "ᵍ",
h: "ʰ",
i: "ⁱ",
j: "ʲ",
k: "ᵏ",
l: "ˡ",
m: "ᵐ",
n: "ⁿ",
o: "ᵒ",
p: "ᵖ",
q: "ᵠ",
r: "ʳ",
s: "ˢ",
t: "ᵗ",
u: "ᵘ",
v: "ᵛ",
w: "ʷ",
x: "ˣ",
y: "ʸ",
z: "ᶻ",
ä: "ᵃᵉ",
ö: "ᵒᵉ",
ü: "ᵘᵉ",
ß: "ˢˢ",
"?": "ˀ",
"!": "ᵎ",
};
a: 'ᵃ',
b: 'ᵇ',
c: 'ᶜ',
d: 'ᵈ',
e: 'ᵉ',
f: 'ᶠ',
g: 'ᵍ',
h: 'ʰ',
i: 'ⁱ',
j: 'ʲ',
k: 'ᵏ',
l: 'ˡ',
m: 'ᵐ',
n: 'ⁿ',
o: 'ᵒ',
p: 'ᵖ',
q: 'ᵠ',
r: 'ʳ',
s: 'ˢ',
t: 'ᵗ',
u: 'ᵘ',
v: 'ᵛ',
w: 'ʷ',
x: 'ˣ',
y: 'ʸ',
z: 'ᶻ',
ä: 'ᵃᵉ',
ö: 'ᵒᵉ',
ü: 'ᵘᵉ',
ß: 'ˢˢ',
'?': 'ˀ',
'!': 'ᵎ',
}
export default tiny;
export default tiny
+1 -1
View File
@@ -1 +1 @@
declare module "braille";
declare module 'braille'
+1 -1
View File
@@ -1 +1 @@
declare module "translatte";
declare module 'translatte'
+54 -47
View File
@@ -1,67 +1,74 @@
import { LinkInstance, LinkExtraction } from "@/constants/interfaces/Links";
import { LinkInstance, LinkExtraction } from '@/constants/interfaces/Links'
function getLinks(str: string) {
const matches = str.match(
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})|((u|r)\/[^\n ]*)/gi
);
let indices: LinkInstance[] = [];
if (matches != null) {
for (let i = 0; i < matches.length; i++) {
indices.push({
index: str.indexOf(matches[i]),
length: matches[i].length,
});
const matches = str.match(
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})|((u|r)\/[^\n ]*)/gi
)
let indices: LinkInstance[] = []
if (matches != null) {
for (let i = 0; i < matches.length; i++) {
indices.push({
index: str.indexOf(matches[i]),
length: matches[i].length,
})
}
}
}
return indices;
return indices
}
function extractLinks(str: string): LinkExtraction {
const links = getLinks(str);
const textParts = [];
const extractedLinks = [];
let endOfLastLink = 0;
const links = getLinks(str)
const textParts = []
const extractedLinks = []
let endOfLastLink = 0
for (const link of links) {
textParts.push(str.substring(endOfLastLink, link.index));
endOfLastLink = link.index + link.length;
extractedLinks.push(str.substring(link.index, endOfLastLink));
}
textParts.push(str.substring(endOfLastLink, str.length));
return { textParts, extractedLinks };
for (const link of links) {
textParts.push(str.substring(endOfLastLink, link.index))
endOfLastLink = link.index + link.length
extractedLinks.push(str.substring(link.index, endOfLastLink))
}
textParts.push(str.substring(endOfLastLink, str.length))
return { textParts, extractedLinks }
}
function insertLinks(textParts: string[], linksToInsert: string[]) {
let result = [];
for (let i = 0; i < linksToInsert.length; i++) {
result.push(textParts[i], linksToInsert[i]);
}
result.push(textParts[textParts.length - 1]);
return result.join("");
let result = []
for (let i = 0; i < linksToInsert.length; i++) {
result.push(textParts[i], linksToInsert[i])
}
result.push(textParts[textParts.length - 1])
return result.join('')
}
function getKeyByValue(value: string, map: Record<string, string>) {
return Object.keys(map).find((key) => map[key] === value) ?? value;
return Object.keys(map).find((key) => map[key] === value) ?? value
}
function getRandomNumber(max: number): number {
return Math.floor(Math.random() * max);
return Math.floor(Math.random() * max)
}
const defaultModifier = (requestText: string, map: Record<string, string>, reverseBeforeModifying = false, reverse = false) => {
const text = reverseBeforeModifying ? [...requestText].reverse().join("") : requestText;
let result = "";
text.split("").forEach(c => {
result += reverse ? getKeyByValue(c, map) : map[c] ?? c;
});
return result;
};
const defaultModifier = (
requestText: string,
map: Record<string, string>,
reverseBeforeModifying = false,
reverse = false
) => {
const text = reverseBeforeModifying
? [...requestText].reverse().join('')
: requestText
let result = ''
text.split('').forEach((c) => {
result += reverse ? getKeyByValue(c, map) : map[c] ?? c
})
return result
}
export {
getKeyByValue,
getLinks,
extractLinks,
insertLinks,
getRandomNumber,
defaultModifier,
};
getKeyByValue,
getLinks,
extractLinks,
insertLinks,
getRandomNumber,
defaultModifier,
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "ɐᴉlɐɹʇsn∀",
value: "australia",
params: [
{
label: "Rückgängig",
value: "reverse",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: 'ɐᴉlɐɹʇsn∀',
value: 'australia',
params: [
{
label: 'Rückgängig',
value: 'reverse',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+7 -7
View File
@@ -1,12 +1,12 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import australiaMap from "../../constants/maps/australia";
import { defaultModifier } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import australiaMap from '../../constants/maps/australia'
import { defaultModifier } from '../../globals/modifierHelpers'
const DEFAULT_PARAMS = {
reverse: false,
};
reverse: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
return defaultModifier(request.text, australiaMap, true, params.reverse);
const params = { ...DEFAULT_PARAMS, ...request.params }
return defaultModifier(request.text, australiaMap, true, params.reverse)
}
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "𝗯𝗼𝗹𝗱",
value: "bold",
};
function: modify,
label: '𝗯𝗼𝗹𝗱',
value: 'bold',
}
export default config;
export default config
+10 -10
View File
@@ -1,13 +1,13 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import boldMap from "../../constants/maps/bold";
import { defaultModifier } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import boldMap from '../../constants/maps/bold'
import { defaultModifier } from '../../globals/modifierHelpers'
export default function modify(request: ModifierRequest) {
return defaultModifier(
request.text
.replaceAll("Ä", "AE")
.replaceAll("Ö", "OE")
.replaceAll("Ü", "UE"),
boldMap
);
return defaultModifier(
request.text
.replaceAll('Ä', 'AE')
.replaceAll('Ö', 'OE')
.replaceAll('Ü', 'UE'),
boldMap
)
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "⠃⠗⠁⠊⠇⠇⠑⠼",
value: "braille",
params: [
{
label: "Rückgängig",
value: "reverse",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: '⠃⠗⠁⠊⠇⠇⠑⠼',
value: 'braille',
params: [
{
label: 'Rückgängig',
value: 'reverse',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+11 -11
View File
@@ -1,17 +1,17 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import braille from "braille";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import braille from 'braille'
const DEFAULT_PARAMS = {
reverse: false,
};
reverse: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
const str = request.text
.toUpperCase()
.replace(/Ä/g, "AE")
.replace(/Ö/g, "OE")
.replace(/Ü/g, "UE");
return params.reverse ? braille.toText(str) : braille.toBraille(str);
const str = request.text
.toUpperCase()
.replace(/Ä/g, 'AE')
.replace(/Ö/g, 'OE')
.replace(/Ü/g, 'UE')
return params.reverse ? braille.toText(str) : braille.toBraille(str)
}
+8 -8
View File
@@ -1,11 +1,11 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "Spermi",
value: "cummy",
hidden: true,
};
function: modify,
label: 'Spermi',
value: 'cummy',
hidden: true,
}
export default config;
export default config
+2 -2
View File
@@ -1,5 +1,5 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
export default function modify(request: ModifierRequest) {
return request.text;
return request.text
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "Emoji😂",
value: "emoji",
params: [
{
label: "Maximale Emoji-Anzahl pro Wort",
value: "maxEmojis",
type: ParamType.NUMBER,
},
],
};
function: modify,
label: 'Emoji😂',
value: 'emoji',
params: [
{
label: 'Maximale Emoji-Anzahl pro Wort',
value: 'maxEmojis',
type: ParamType.NUMBER,
},
],
}
export default config;
export default config
+125 -120
View File
@@ -1,153 +1,158 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import {
extractLinks,
insertLinks,
getRandomNumber,
} from "../../globals/modifierHelpers";
import { LinkExtraction } from "@/constants/interfaces/Links";
import stringSimilarity from "string-similarity";
import emojiMap from "../../constants/maps/emoji";
extractLinks,
insertLinks,
getRandomNumber,
} from '../../globals/modifierHelpers'
import { LinkExtraction } from '@/constants/interfaces/Links'
import stringSimilarity from 'string-similarity'
import emojiMap from '../../constants/maps/emoji'
interface EmojiString {
strippedString: string;
originalString: string;
emojiIndex: number;
strippedString: string
originalString: string
emojiIndex: number
}
const DEFAULT_PARAMS = {
maxEmojis: 2,
};
maxEmojis: 2,
}
const numberMap = {
"0": "0️⃣",
"1": "1️⃣",
"2": "2️⃣",
"3": "3️⃣",
"4": "4️⃣",
"5": "5️⃣",
"6": "6️⃣",
"7": "7️⃣",
"8": "8️⃣",
"9": "9️⃣",
};
'0': '0️⃣',
'1': '1️⃣',
'2': '2️⃣',
'3': '3️⃣',
'4': '4️⃣',
'5': '5️⃣',
'6': '6️⃣',
'7': '7️⃣',
'8': '8️⃣',
'9': '9️⃣',
}
const PUNCTUATION_MARKS = [
",",
".",
"!",
"?",
";",
"(",
")",
'"',
"'",
":",
"-",
];
',',
'.',
'!',
'?',
';',
'(',
')',
'"',
"'",
':',
'-',
]
const REGEX_EVERY_PUNCTUATION = new RegExp(
`[${PUNCTUATION_MARKS.join("")}]+`,
"g"
);
`[${PUNCTUATION_MARKS.join('')}]+`,
'g'
)
const REGEX_TRAILING_PUNCTUATION = new RegExp(
`[${PUNCTUATION_MARKS.join("")}]*$`
);
`[${PUNCTUATION_MARKS.join('')}]*$`
)
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
const textWithNumberEmojis = replaceAllNumbers(request.text);
const textWithNumberEmojis = replaceAllNumbers(request.text)
const words = textWithNumberEmojis.split(" ");
let numberEmojis;
let emoji;
let emojis;
let emojiArray;
let result = "";
const dbWords = Object.keys(emojiMap);
for (let word of words) {
let dbWord;
const emojiString = removePunctuations(word);
if (emojiString.strippedString.length >= 6) {
let bestMatch = stringSimilarity.findBestMatch(
emojiString.strippedString,
dbWords
).bestMatch;
if (bestMatch.rating >= 0.7) {
dbWord = emojiMap[bestMatch.target as keyof typeof emojiMap];
}
} else {
dbWord = emojiMap[emojiString.strippedString as keyof typeof emojiMap];
}
result += emojiString.originalString.substring(0, emojiString.emojiIndex);
emojis = "";
if (dbWord && dbWord.length) {
emojiArray = JSON.parse(JSON.stringify(dbWord));
} else {
result +=
emojiString.originalString.substring(emojiString.emojiIndex) + " ";
continue;
}
numberEmojis = getRandomNumber(params.maxEmojis) + 1; // should have atleast 1 emoji
emoji = "";
if (emojiArray) {
for (let i = 0; i < numberEmojis; i++) {
const randomNumber = getRandomNumber(emojiArray.length);
emoji = emojiArray[randomNumber];
if (emojis.includes(emoji) || !emoji) {
continue;
const words = textWithNumberEmojis.split(' ')
let numberEmojis
let emoji
let emojis
let emojiArray
let result = ''
const dbWords = Object.keys(emojiMap)
for (let word of words) {
let dbWord
const emojiString = removePunctuations(word)
if (emojiString.strippedString.length >= 6) {
let bestMatch = stringSimilarity.findBestMatch(
emojiString.strippedString,
dbWords
).bestMatch
if (bestMatch.rating >= 0.7) {
dbWord = emojiMap[bestMatch.target as keyof typeof emojiMap]
}
} else {
dbWord =
emojiMap[emojiString.strippedString as keyof typeof emojiMap]
}
emojis += emoji;
}
}
result +=
emojis +
emojiString.originalString.substring(emojiString.emojiIndex) +
" ";
}
return result.substring(0, result.length - 1);
result += emojiString.originalString.substring(
0,
emojiString.emojiIndex
)
emojis = ''
if (dbWord && dbWord.length) {
emojiArray = JSON.parse(JSON.stringify(dbWord))
} else {
result +=
emojiString.originalString.substring(emojiString.emojiIndex) +
' '
continue
}
numberEmojis = getRandomNumber(params.maxEmojis) + 1 // should have atleast 1 emoji
emoji = ''
if (emojiArray) {
for (let i = 0; i < numberEmojis; i++) {
const randomNumber = getRandomNumber(emojiArray.length)
emoji = emojiArray[randomNumber]
if (emojis.includes(emoji) || !emoji) {
continue
}
emojis += emoji
}
}
result +=
emojis +
emojiString.originalString.substring(emojiString.emojiIndex) +
' '
}
return result.substring(0, result.length - 1)
}
function replaceAllNumbers(str: string) {
const splitString: LinkExtraction = extractLinks(str);
const splitString: LinkExtraction = extractLinks(str)
let editedTextParts: string[] = [];
splitString.textParts.forEach((textPart) => {
editedTextParts.push(replaceNumbers(textPart));
});
let editedTextParts: string[] = []
splitString.textParts.forEach((textPart) => {
editedTextParts.push(replaceNumbers(textPart))
})
return insertLinks(editedTextParts, splitString.extractedLinks);
return insertLinks(editedTextParts, splitString.extractedLinks)
}
function replaceNumbers(str: string) {
const regex = /[0-9]/g;
let result = str;
let match: RegExpExecArray | null;
while ((match = regex.exec(result))) {
result =
result.substring(0, match.index) +
numberMap[match[0] as keyof typeof numberMap] +
result.substring(match.index + 1);
}
return result;
const regex = /[0-9]/g
let result = str
let match: RegExpExecArray | null
while ((match = regex.exec(result))) {
result =
result.substring(0, match.index) +
numberMap[match[0] as keyof typeof numberMap] +
result.substring(match.index + 1)
}
return result
}
function removePunctuations(str: string): EmojiString {
const lowerStr = str.toLowerCase();
if (!PUNCTUATION_MARKS.some((punctuation) => str.includes(punctuation))) {
return {
strippedString: lowerStr,
originalString: str,
emojiIndex: str.length,
};
}
const lowerStr = str.toLowerCase()
if (!PUNCTUATION_MARKS.some((punctuation) => str.includes(punctuation))) {
return {
strippedString: lowerStr,
originalString: str,
emojiIndex: str.length,
}
}
return {
strippedString: lowerStr.replace(REGEX_EVERY_PUNCTUATION, ""),
originalString: str,
emojiIndex: REGEX_TRAILING_PUNCTUATION.exec(str).index,
};
return {
strippedString: lowerStr.replace(REGEX_EVERY_PUNCTUATION, ''),
originalString: str,
emojiIndex: REGEX_TRAILING_PUNCTUATION.exec(str).index,
}
}
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "ℱ𝒶𝓃𝒸𝓎",
value: "fancy",
};
function: modify,
label: 'ℱ𝒶𝓃𝒸𝓎',
value: 'fancy',
}
export default config;
export default config
+4 -4
View File
@@ -1,7 +1,7 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import fancyMap from "../../constants/maps/fancy";
import { defaultModifier } from '../../globals/modifierHelpers';
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import fancyMap from '../../constants/maps/fancy'
import { defaultModifier } from '../../globals/modifierHelpers'
export default function modify(request: ModifierRequest) {
return defaultModifier(request.text, fancyMap);
return defaultModifier(request.text, fancyMap)
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import generate from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import generate from './modifier'
const config: ModifierConfig = {
function: generate,
label: "𝔉𝔯𝔞𝔨𝔱𝔲𝔯",
value: "fraktur",
params: [
{
label: "Fett",
value: "bold",
type: ParamType.BOOLEAN,
},
],
};
function: generate,
label: '𝔉𝔯𝔞𝔨𝔱𝔲𝔯',
value: 'fraktur',
params: [
{
label: 'Fett',
value: 'bold',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+11 -8
View File
@@ -1,13 +1,16 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import { defaultModifier } from "../../globals/modifierHelpers";
import { fraktur as frakturMap, frakturBold as frakturBoldMap } from "../../constants/maps/fraktur";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import { defaultModifier } from '../../globals/modifierHelpers'
import {
fraktur as frakturMap,
frakturBold as frakturBoldMap,
} from '../../constants/maps/fraktur'
const DEFAULT_PARAMS = {
bold: false,
};
bold: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const fractureMap = params.bold ? frakturBoldMap : frakturMap;
return defaultModifier(request.text, fractureMap);
const params = { ...DEFAULT_PARAMS, ...request.params }
const fractureMap = params.bold ? frakturBoldMap : frakturMap
return defaultModifier(request.text, fractureMap)
}
+15 -15
View File
@@ -1,20 +1,20 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import fs from "fs";
import path from "path";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import fs from 'fs'
import path from 'path'
const modifiers: Record<string, ModifierConfig> = {};
const modifiers: Record<string, ModifierConfig> = {}
fs.readdirSync(__dirname)
.filter((file) => !file.startsWith("index.js"))
.forEach((dir) => {
const dirPath = path.join(__dirname, dir);
.filter((file) => !file.startsWith('index.js'))
.forEach((dir) => {
const dirPath = path.join(__dirname, dir)
fs.readdirSync(dirPath)
.filter((file) => file === "config.js")
.map((file) => path.join(dirPath, file))
.map((file) => require(file))
.map((config) => config.default)
.forEach((config) => (modifiers[config.value] = config));
});
fs.readdirSync(dirPath)
.filter((file) => file === 'config.js')
.map((file) => path.join(dirPath, file))
.map((file) => require(file))
.map((config) => config.default)
.forEach((config) => (modifiers[config.value] = config))
})
export default modifiers;
export default modifiers
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "𝘐𝘵𝘢𝘭𝘪𝘤",
value: "italic",
};
function: modify,
label: '𝘐𝘵𝘢𝘭𝘪𝘤',
value: 'italic',
}
export default config;
export default config
+4 -4
View File
@@ -1,7 +1,7 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import { defaultModifier } from "../../globals/modifierHelpers";
import italicMap from "../../constants/maps/italic";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import { defaultModifier } from '../../globals/modifierHelpers'
import italicMap from '../../constants/maps/italic'
export default function modify(request: ModifierRequest) {
return defaultModifier(request.text, italicMap);
return defaultModifier(request.text, italicMap)
}
+20 -20
View File
@@ -1,23 +1,23 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "1337",
value: "leet",
params: [
{
label: "Erweitert",
value: "advanced",
type: ParamType.BOOLEAN,
},
{
label: "Rückgängig",
value: "reverse",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: '1337',
value: 'leet',
params: [
{
label: 'Erweitert',
value: 'advanced',
type: ParamType.BOOLEAN,
},
{
label: 'Rückgängig',
value: 'reverse',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+31 -31
View File
@@ -1,42 +1,42 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import {
alphabetBasic,
alphabetAdvanced,
alphabetReversed,
} from "../../constants/maps/leet";
alphabetBasic,
alphabetAdvanced,
alphabetReversed,
} from '../../constants/maps/leet'
const DEFAULT_PARAMS = {
advanced: false,
reverse: false,
};
advanced: false,
reverse: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
let str = request.text;
if (params.reverse) {
alphabetReversed.map((x: any[]) => {
str = str.replace(x[0], x[1]);
});
return str;
}
if (params.advanced) {
str = leetify(str, alphabetAdvanced);
}
return leetify(str, alphabetBasic);
let str = request.text
if (params.reverse) {
alphabetReversed.map((x: any[]) => {
str = str.replace(x[0], x[1])
})
return str
}
if (params.advanced) {
str = leetify(str, alphabetAdvanced)
}
return leetify(str, alphabetBasic)
}
function leetify(str: string, ar: Record<string, string>) {
let result = "";
for (let char of str) {
//TODO: better way of handling this corner case?
if (char === "F") {
result += "PH";
continue;
let result = ''
for (let char of str) {
//TODO: better way of handling this corner case?
if (char === 'F') {
result += 'PH'
continue
}
let leetChar = ar[char.toLowerCase()]
if (leetChar) result += leetChar
else result += char
}
let leetChar = ar[char.toLowerCase()];
if (leetChar) result += leetChar;
else result += char;
}
return result;
return result
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "ɿoɿɿiM",
value: "mirror",
params: [
{
label: "Rückgängig",
value: "reverse",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: 'ɿoɿɿiM',
value: 'mirror',
params: [
{
label: 'Rückgängig',
value: 'reverse',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+7 -7
View File
@@ -1,12 +1,12 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import mirrorMap from "../../constants/maps/mirror";
import { defaultModifier } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import mirrorMap from '../../constants/maps/mirror'
import { defaultModifier } from '../../globals/modifierHelpers'
const DEFAULT_PARAMS = {
reverse: false,
};
reverse: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
return defaultModifier(request.text, mirrorMap, true, params.reverse);
const params = { ...DEFAULT_PARAMS, ...request.params }
return defaultModifier(request.text, mirrorMap, true, params.reverse)
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "MoCk",
value: "mock",
params: [
{
label: "Mit Großbuchstaben beginnen",
value: "startLowerCase",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: 'MoCk',
value: 'mock',
params: [
{
label: 'Mit Großbuchstaben beginnen',
value: 'startLowerCase',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+15 -15
View File
@@ -1,22 +1,22 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
const DEFAULT_PARAMS = {
startLowerCase: false,
};
startLowerCase: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
let result = "";
for (let i = 0; i < request.text.length; i++) {
let char = request.text[i];
let flag = params.startLowerCase ? 0 : 1;
if (i % 2 === flag) {
char = char.toLowerCase();
} else {
char = char.toUpperCase();
let result = ''
for (let i = 0; i < request.text.length; i++) {
let char = request.text[i]
let flag = params.startLowerCase ? 0 : 1
if (i % 2 === flag) {
char = char.toLowerCase()
} else {
char = char.toUpperCase()
}
result += char
}
result += char;
}
return result;
return result
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "-- --- .-. ... .",
value: "morse",
params: [
{
label: "Rückgängig",
value: "reverse",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: '-- --- .-. ... .',
value: 'morse',
params: [
{
label: 'Rückgängig',
value: 'reverse',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+21 -21
View File
@@ -1,27 +1,27 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import morseMap from "../../constants/maps/morse";
import { getKeyByValue } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import morseMap from '../../constants/maps/morse'
import { getKeyByValue } from '../../globals/modifierHelpers'
const DEFAULT_PARAMS = {
reverse: false,
};
reverse: false,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
return params.reverse
? request.text
.split(" ")
.map((el) => {
return el === "" ? " " : getKeyByValue(el, morseMap);
})
.join("")
.replace(/ /g, " ")
: request.text
.toLowerCase()
.split("")
.map((el) => {
return morseMap[el as keyof typeof morseMap] ?? el;
})
.join(" ");
return params.reverse
? request.text
.split(' ')
.map((el) => {
return el === '' ? ' ' : getKeyByValue(el, morseMap)
})
.join('')
.replace(/ /g, ' ')
: request.text
.toLowerCase()
.split('')
.map((el) => {
return morseMap[el as keyof typeof morseMap] ?? el
})
.join(' ')
}
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "Meddl",
value: "ogre",
};
function: modify,
label: 'Meddl',
value: 'ogre',
}
export default config;
export default config
+11 -11
View File
@@ -1,14 +1,14 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ogreMap from "../../constants/maps/ogre";
import { getRandomNumber } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import ogreMap from '../../constants/maps/ogre'
import { getRandomNumber } from '../../globals/modifierHelpers'
export default async function modify(request: ModifierRequest) {
let result = request.text;
for (let [key, value] of Object.entries(ogreMap)) {
const length = value.length;
result = result.replaceAll(key, () => {
return value[getRandomNumber(length)];
});
}
return result;
let result = request.text
for (let [key, value] of Object.entries(ogreMap)) {
const length = value.length
result = result.replaceAll(key, () => {
return value[getRandomNumber(length)]
})
}
return result
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "owo",
value: "owo",
params: [
{
label: "Anschmiegen",
value: "nuzzle",
type: ParamType.BOOLEAN,
},
],
};
function: modify,
label: 'owo',
value: 'owo',
params: [
{
label: 'Anschmiegen',
value: 'nuzzle',
type: ParamType.BOOLEAN,
},
],
}
export default config;
export default config
+42 -41
View File
@@ -1,53 +1,54 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import { getLinks } from "../../globals/modifierHelpers";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import { getLinks } from '../../globals/modifierHelpers'
const NUZZLE_TEXT = "*schmiegt an*";
const NUZZLE_TEXT = '*schmiegt an*'
const DEFAULT_PARAMS = {
nuzzle: true,
};
nuzzle: true,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
let links = getLinks(request.text);
let result = "";
for (let i = 0; i < request.text.length; i++) {
let url = links.find((link) => i === link.index)?.length;
let c = request.text[i];
if (!url) {
if (c == "\\" && i < request.text.length) {
c = "\\" + request.text[i + 1];
i++;
} else {
if (c == "l" || c == "r") {
c = "w";
} else if (c == "L" || c == "R") {
c = "W";
} else if (c.toLowerCase() == "n" && i < request.text.length) {
if (isVowel(request.text[i + 1])) {
if (c == "n") {
c = "ny";
} else if (
c == "N" &&
request.text[i + 1].toUpperCase() == request.text[i + 1]
) {
c = "NY";
let links = getLinks(request.text)
let result = ''
for (let i = 0; i < request.text.length; i++) {
let url = links.find((link) => i === link.index)?.length
let c = request.text[i]
if (!url) {
if (c == '\\' && i < request.text.length) {
c = '\\' + request.text[i + 1]
i++
} else {
if (c == 'l' || c == 'r') {
c = 'w'
} else if (c == 'L' || c == 'R') {
c = 'W'
} else if (c.toLowerCase() == 'n' && i < request.text.length) {
if (isVowel(request.text[i + 1])) {
if (c == 'n') {
c = 'ny'
} else if (
c == 'N' &&
request.text[i + 1].toUpperCase() ==
request.text[i + 1]
) {
c = 'NY'
}
}
}
}
}
} else {
c = request.text.substring(i, i + url)
i += url - 1
}
}
} else {
c = request.text.substring(i, i + url);
i += url - 1;
result += c
}
result += c;
}
if (params.nuzzle) {
return [result, NUZZLE_TEXT].join(" ");
}
return result;
if (params.nuzzle) {
return [result, NUZZLE_TEXT].join(' ')
}
return result
}
function isVowel(s: string) {
return /^[aeiou]$/i.test(s);
return /^[aeiou]$/i.test(s)
}
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶̶",
value: "strikethrough",
};
function: modify,
label: 'S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶̶',
value: 'strikethrough',
}
export default config;
export default config
+5 -5
View File
@@ -1,9 +1,9 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
const STRIKETHROUGH_CHAR = String.fromCharCode(822);
const STRIKETHROUGH_CHAR = String.fromCharCode(822)
export default function modify(request: ModifierRequest) {
const matches = request.text.match(/./g);
// strike must be after every char, and join just adds it in between. So we have to add one to the end
return matches.join(STRIKETHROUGH_CHAR) + STRIKETHROUGH_CHAR;
const matches = request.text.match(/./g)
// strike must be after every char, and join just adds it in between. So we have to add one to the end
return matches.join(STRIKETHROUGH_CHAR) + STRIKETHROUGH_CHAR
}
+7 -7
View File
@@ -1,10 +1,10 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "ᵗⁱⁿʸ",
value: "tiny",
};
function: modify,
label: 'ᵗⁱⁿʸ',
value: 'tiny',
}
export default config;
export default config
+4 -4
View File
@@ -1,7 +1,7 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import tinyMap from "../../constants/maps/tiny";
import { defaultModifier } from '../../globals/modifierHelpers';
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import tinyMap from '../../constants/maps/tiny'
import { defaultModifier } from '../../globals/modifierHelpers'
export default function modify(request: ModifierRequest) {
return defaultModifier(request.text.toLowerCase(), tinyMap);
return defaultModifier(request.text.toLowerCase(), tinyMap)
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "(Shitty) Translate",
value: "translate",
params: [
{
label: "Anzahl Übersetzungen",
value: "numberTranslations",
type: ParamType.NUMBER,
},
],
};
function: modify,
label: '(Shitty) Translate',
value: 'translate',
params: [
{
label: 'Anzahl Übersetzungen',
value: 'numberTranslations',
type: ParamType.NUMBER,
},
],
}
export default config;
export default config
+22 -34
View File
@@ -1,44 +1,32 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import translatte from "translatte";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import translatte from 'translatte'
const langs = [
"en",
"fr",
"tr",
"it",
"la",
"zu",
"sl",
"ru",
"ja",
"hr",
"nl",
];
const langs = ['en', 'fr', 'tr', 'it', 'la', 'zu', 'sl', 'ru', 'ja', 'hr', 'nl']
const DEFAULT_PARAMS = {
numberTranslations: 3,
};
numberTranslations: 3,
}
export default async function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
return await translateShitty(request.text, params.numberTranslations);
const params = { ...DEFAULT_PARAMS, ...request.params }
return await translateShitty(request.text, params.numberTranslations)
}
const translateShitty = async (
str: string,
n: number,
langIndex = 0,
tries = 0
str: string,
n: number,
langIndex = 0,
tries = 0
): Promise<string> => {
try {
if (langIndex === n) {
const result = await translatte(str, { to: "de" });
return result.text;
try {
if (langIndex === n) {
const result = await translatte(str, { to: 'de' })
return result.text
}
const result = await translatte(str, { to: langs[langIndex] })
return translateShitty(result.text, n, langIndex + 1)
} catch (error) {
console.log(error)
return translateShitty(str, langIndex, tries + 1)
}
const result = await translatte(str, { to: langs[langIndex] });
return translateShitty(result.text, n, langIndex + 1);
} catch (error) {
console.log(error);
return translateShitty(str, langIndex, tries + 1);
}
};
}
+15 -15
View File
@@ -1,18 +1,18 @@
import ModifierConfig from "@/constants/interfaces/ModifierConfig";
import ParamType from "../../constants/enums/ParamType";
import modify from "./modifier";
import ModifierConfig from '@/constants/interfaces/ModifierConfig'
import ParamType from '../../constants/enums/ParamType'
import modify from './modifier'
const config: ModifierConfig = {
function: modify,
label: "Z̙̐̏ḁ̇̊l̛̝͑g̢͓̰ơ̜̠",
value: "zalgo",
params: [
{
label: "Intensität",
value: "intensity",
type: ParamType.NUMBER,
},
],
};
function: modify,
label: 'Z̙̐̏ḁ̇̊l̛̝͑g̢͓̰ơ̜̠',
value: 'zalgo',
params: [
{
label: 'Intensität',
value: 'intensity',
type: ParamType.NUMBER,
},
],
}
export default config;
export default config
+17 -13
View File
@@ -1,25 +1,29 @@
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
const DEFAULT_PARAMS = {
intensity: 2,
};
intensity: 2,
}
export default function modify(request: ModifierRequest) {
const params = { ...DEFAULT_PARAMS, ...request.params };
const params = { ...DEFAULT_PARAMS, ...request.params }
if (isNaN(params.intensity) || params.intensity < 0 || params.intensity > 100)
return "Invalid intensity param";
let result = "";
request.text.split("").forEach(function (c) {
result += c + getZalgoString(params.intensity);
});
return result;
if (
isNaN(params.intensity) ||
params.intensity < 0 ||
params.intensity > 100
)
return 'Invalid intensity param'
let result = ''
request.text.split('').forEach(function (c) {
result += c + getZalgoString(params.intensity)
})
return result
}
function getZalgoChar() {
return String.fromCharCode(Math.random() * (880 - 768) + 768);
return String.fromCharCode(Math.random() * (880 - 768) + 768)
}
function getZalgoString(n: number): string {
return n === 0 ? getZalgoChar() : getZalgoChar() + getZalgoString(n - 1);
return n === 0 ? getZalgoChar() : getZalgoChar() + getZalgoString(n - 1)
}
+29 -27
View File
@@ -1,37 +1,39 @@
import ModifierResponse from "@/constants/interfaces/ModifierResponse";
import ModifierRequest from "@/constants/interfaces/ModifierRequest";
import express from "express";
import modifiers from "../modifiers";
import ModifierResponse from '@/constants/interfaces/ModifierResponse'
import ModifierRequest from '@/constants/interfaces/ModifierRequest'
import express from 'express'
import modifiers from '../modifiers'
const router = express.Router();
const router = express.Router()
Object.keys(modifiers).forEach((modifierKey: keyof typeof modifiers) => {
router.post("/" + modifiers[modifierKey].value, async function (
req: express.Request,
res: express.Response
) {
res.status(200).send(await compute(req.body, req.url.substring(1).toLowerCase()));
});
});
router.post(
'/' + modifiers[modifierKey].value,
async function (req: express.Request, res: express.Response) {
res.status(200).send(
await compute(req.body, req.url.substring(1).toLowerCase())
)
}
)
})
router.get("/", async function (_req, res) {
const result = modifiers;
res.status(200).send(result);
});
router.get('/', async function (_req, res) {
const result = modifiers
res.status(200).send(result)
})
async function compute(
req: ModifierRequest,
url: string
req: ModifierRequest,
url: string
): Promise<ModifierResponse> {
console.log("Received call to", url);
const modifierFunction = modifiers[url].function;
const oldTime = Date.now();
const modified = await modifierFunction(req);
const time = Date.now() - oldTime;
console.log("Response is", modified);
console.log("Time was", time);
console.log('Received call to', url)
const modifierFunction = modifiers[url].function
const oldTime = Date.now()
const modified = await modifierFunction(req)
const time = Date.now() - oldTime
console.log('Response is', modified)
console.log('Time was', time)
return { text: modified, time };
return { text: modified, time }
}
export default router;
export default router
+5 -5
View File
@@ -1,8 +1,8 @@
import app from "./app";
import http from "http";
import app from './app'
import http from 'http'
const port = process.argv[2] === "DEBUG" ? 80 : process.env.PORT;
const port = process.argv[2] === 'DEBUG' ? 80 : process.env.PORT
http.createServer(app).listen(port, function () {
console.log("App listens on port: " + this.address().port);
});
console.log('App listens on port: ' + this.address().port)
})
+17 -17
View File
@@ -1,19 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": ["ES2021.String"],
"resolveJsonModule": true,
"paths": {
"@/*": ["src/*", "dist/*"]
}
},
"include": ["src/**/*"]
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es6",
"noImplicitAny": true,
"moduleResolution": "node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"lib": ["ES2021.String"],
"resolveJsonModule": true,
"paths": {
"@/*": ["src/*", "dist/*"]
}
},
"include": ["src/**/*"]
}