32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
const ebinFaces = [
|
|
':D', ':DD', ':DDD', ':-D',
|
|
'XD', 'XXD', 'XDD', 'XXDD'
|
|
];
|
|
const replacements = [
|
|
['wh', 'w'], ['th', 'd'], ['af', 'ab'], ['ap', 'ab'],
|
|
['ca', 'ga'], ['ck', 'gg'], ['co', 'go'], ['ev', 'eb'],
|
|
['ex', 'egz'], ['et', 'ed'], ['iv', 'ib'], ['it', 'id'],
|
|
['ke', 'ge'], ['nt', 'nd'], ['op', 'ob'], ['ot', 'od'],
|
|
['po', 'bo'], ['pe', 'be'], ['pi', 'bi'], ['up', 'ub'],
|
|
['va', 'ba'], ['ck', 'gg'], ['cr', 'gr'], ['kn', 'gn'],
|
|
['lt', 'ld'], ['mm', 'm'], ['nt', 'dn'], ['pr', 'br'],
|
|
['ts', 'dz'], ['tr', 'dr'], ['bs', 'bz'], ['ds', 'dz'],
|
|
['es', 'es'], ['fs', 'fz'], ['gs', 'gz'], [' is', ' iz'],
|
|
['ls', 'lz'], ['ms', 'mz'], ['ns', 'nz'], ['rs', 'rz'],
|
|
['ss', 'sz'], ['ts', 'tz'], ['us', 'uz'], ['ws', 'wz'],
|
|
['ys', 'yz'], ['alk', 'olk'], ['ing', 'ign'], ['ic', 'ig'],
|
|
['ng', 'nk'], ['kek', 'geg'], ['epic', 'ebin'], ['some', 'sum'],
|
|
['meme', 'maymay']
|
|
];
|
|
|
|
export function spurdo(text) {
|
|
text = text.toLowerCase();
|
|
replacements.forEach(filter => {
|
|
let replaceFrom = new RegExp(filter[0], 'gm')
|
|
, replaceTo = filter[1];
|
|
text = text.replace(replaceFrom, replaceTo);
|
|
});
|
|
while (text.match(/\.|,(?=\s|$)/m))
|
|
text = text.replace(/\.|,(?=\s|$)/m, ' ' + ebinFaces[~~(Math.random() * ebinFaces.length)]);
|
|
return text;
|
|
} |