you seem to be trying to "fix" the language, at the cost of unnecessary overhead in both compute time and your time.
function fact (input) {
switch (input) {
case 0: return 1
default: return (n) => n * fact(n-1)
}
}
function protocols ({useGit, useSSH, useHTTP, useHTTPS}) {
switch (true) {
case useGit && useSSH: return 'git+ssh'
case useGit && useHTTP: return 'git+http'
case useGit && useHTTPS: return 'git+https'
default: return 'unsupported'
}
}
['hey.com', 'fg@plop.com', 'fg+plop@plop.com', 'wat'].filter((email) => !/\S+@\S+\.\S+/.test(email))
you seem to be trying to "fix" the language, at the cost of unnecessary overhead in both compute time and your time.