Skip to content

Instantly share code, notes, and snippets.

@madr madr/rövardansen.js

Last active Sep 4, 2017
What would you like to do?
function encrypt (str) {
return str.replace(/([^aeiouöäå01-9])/gi, (c) => { return `${c}o${c}`; });
function decrypt (str) {
return str.replace(/([^aeiouöäå01-9])o([^aeiouöäå01-9])/gi, (origin, first, last) => {
return (first == last)? first: origin;
let encrypted = encrypt("Rövarspråket"); // "RoRövovarorsospoproråkoketot"
let decrypted = decrypt(encrypted); // "Rövarspråket"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.