Skip to content

Instantly share code, notes, and snippets.

@mcsf
Created August 7, 2020 14:34
Show Gist options
  • Select an option

  • Save mcsf/975e453f035fa382fd8504795ff2c651 to your computer and use it in GitHub Desktop.

Select an option

Save mcsf/975e453f035fa382fd8504795ff2c651 to your computer and use it in GitHub Desktop.
It's a silly world out there.
#!/usr/bin/env node
const fs = require('fs');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false,
});
rl.on('line', line => {
console.log(derpCase(line));
});
function derpCase(string) {
return Array.from(string).map(c =>
Math.random() > 0.5
? c.toUpperCase()
: c.toLowerCase()
).join('');
}
@mcsf
Copy link
Author

mcsf commented Aug 7, 2020

$ echo 'Hello, world!' | derp-case 
hELlo, wOrLd!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment