Skip to content

Instantly share code, notes, and snippets.

@keesey
Last active November 20, 2019 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keesey/af7160e877162becb1ed07d9f149dd80 to your computer and use it in GitHub Desktop.
Save keesey/af7160e877162becb1ed07d9f149dd80 to your computer and use it in GitHub Desktop.
const comixify = (s, next = {}) => s
.split("")
.map(c => {
if (!/^[A-HJ-Z]$/i.test(c)) return c;
const C = c.toUpperCase();
return (next[C] = !next[C]) ? C : c.toLowerCase();
})
.join("");
const comixifyAll = (lines, next = {}) => lines.map(line => comixify(line, next)).join("\n\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment