FGRibreau / FGRibreau/match-when

Sugar is expensive

Open
#20 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
524
Forks
16
PR merge metrics
No merged PRs in 30d

Description

you seem to be trying to "fix" the language, at the cost of unnecessary overhead in both compute time and your time.

``` js
function fact (input) {
switch (input) {
case 0: return 1
default: return (n) => n * fact(n-1)
}
}
```

``` js
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'
}
}
```

``` js
['hey.com', 'fg@plop.com', 'fg+plop@plop.com', 'wat'].filter((email) => !/\S+@\S+\.\S+/.test(email))
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.