Created
March 10, 2018 20:07
-
-
Save Legend-of-iPhoenix/8d1de5af5a612656d7f09567698e864d to your computer and use it in GitHub Desktop.
Enlarges ascii art.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = document.getElementById('input').value; | |
/* | |
First string is the 'index', with escaped characters for each substitution, in order. First character = first array, second character = second array, etc. | |
Each array is of the format ['abc','def','ghi'], which maps to | |
abc | |
def | |
ghi | |
in the output. | |
*/ | |
var substitutions = [ | |
" /\\_-'", | |
[' ', ' ', ' '], | |
['/ ', ' / ', ' /'], | |
[' \\', ' \\ ', '\\ '], | |
['___', ' ', ' '], | |
[' ', '---', ' '], | |
[' ', '"\\ ', '\\ '] | |
]; | |
substitutions = substitutions.map(x => ((typeof x) !== "string") ? [x[2], x[1], x[0]] : x) | |
document.getElementById('output').innerHTML = '<pre>' + string.split('\n') | |
.map(row => row.split('') | |
.map(char => substitutions[substitutions[0].indexOf(char)])) | |
.map(oldRow => oldRow.map(charSet => charSet ? charSet[0] : []) | |
.join('') + '\n' + oldRow.map(charSet => charSet ? charSet[1] : []) | |
.join('') + '\n' + oldRow.map(charSet => charSet ? charSet[2] : []) | |
.join('')) | |
.join('\n') + '</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment