asciitxt/.github/codegen.js

30 lines
587 B
JavaScript
Raw Permalink Normal View History

2021-10-27 12:42:25 +00:00
/**
* A simple codegen to generate the array of array letter
*/
const fs = require('fs/promises');
// If you used this codegen, don't forget to reset
// the letters array just to be a single value.
2021-10-27 12:42:25 +00:00
const letters =
[
2021-10-28 04:33:33 +00:00
` _
(_)
| |
| |
|_|
`,
]
2021-10-27 12:42:25 +00:00
;(async () => {
let output = ''
for (const letter of letters) {
let split = letter.split('\n');
output += `case "":\n`
output += `return []string{\n`
for (const s of split) {
output += '`'+s+'`,\n'
}
output += "}\n";
}
2021-10-28 04:33:33 +00:00
await fs.writeFile('./generated.go', output, { encoding: 'utf-8' });
2021-10-27 12:42:25 +00:00
})();