isEven というGitHubトレンドに突如現れたライブラリ。
プロジェクト
This is a 100% serious project,
そのプロジェクト。
中身がこれ
!?!?!
となる
作者
マジレス
isEven = (n)=>{
if (n % 2 == 1)
return false;
return true;
}
しかし容赦はないコメント
What is %? I don't get it
Yes, please don't put file size over readability. The old code is perfectly readable, while this would introduce some weird percentage arithmetic. It's safer to write out the cases explicitly.
What I do like in your code is that return true and return false is programmed out explicitly instead of doing some hard-to-read magic like return n % 2 != 1. Maybe you could make a PR that changes:
function isEven(number) {
if (isEvenInternal(number))
return true;
return false;
}
function isEvenInternal(number) {
...
isOdd
is odd もある...。
これは別物
$ curl https://api.isevenapi.xyz/api/iseven/6/
{
"iseven": true,
"ad": "Buy isEvenCoin, the hottest new cryptocurrency!"
}
まとめ
意外とpull request と discussionが勉強になる かもしれない。
改善は続く...
色々なことを考える人がいるものだ。以上です。