We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web互換性のためにObject.groupByになった。 Map.groupBy(array, fn)もある。
Object.groupBy
Map.groupBy(array, fn)
グループ化は頻出ではあるので含めるのは妥当そうだけど、配置が難しい
Array.prototype.group
Object.groupBy(array, cb)
Array.prototype.groupToMap
Map.groupBy(array, cb)
という経緯。 どちらも配列を引数として受け取るようになってるので、配列関係。
データの変換的に見れば
Map.groupBy
として捉えられる。
Object.groupByは、 配列 to objectなので、Array.prototype.reduce の近くにあるのが良さそう。 Map.groupByは、Map/Setにあるのが良さそう。 Map.groupByはちょっと必要かは怪しい。
Originally posted by @azu in #1706 (comment)
The text was updated successfully, but these errors were encountered:
@koralle 配列の章とMap/Setの章は別々のPRとして進めるのが良いと思います。(Assignするためにmentionしちゃいましたが、なぜかAssignはできなかった…)
Sorry, something went wrong.
作業としては毎回こういうイメージのことをやっています。
ちょっと考えるところとしては、Web互換性のためにStatic Methodになってるというのを説明するべきかどうかという点ぐらいなのかなとは思います。(多分冗長になるので不要になりそうな気はしています)
参考
@azu ありがとうございます。
No branches or pull requests
tc39/proposal-array-grouping: A proposal to make grouping of array items easier
Web互換性のために
Object.groupBy
になった。Map.groupBy(array, fn)
もある。グループ化は頻出ではあるので含めるのは妥当そうだけど、配置が難しい
Array.prototype.group
→Object.groupBy(array, cb)
Array.prototype.groupToMap
→Map.groupBy(array, cb)
という経緯。
どちらも配列を引数として受け取るようになってるので、配列関係。
データの変換的に見れば
Object.groupBy
は 配列をオブジェクトにするメソッドMap.groupBy
は配列をMapにするメソッドとして捉えられる。
Object.groupBy
は、 配列 to objectなので、Array.prototype.reduce の近くにあるのが良さそう。Map.groupBy
は、Map/Setにあるのが良さそう。Map.groupBy
はちょっと必要かは怪しい。TODO
Object.groupBy
: 配列の章に追加するMap.groupBy
は Map/Setの章に追加する?Originally posted by @azu in #1706 (comment)
The text was updated successfully, but these errors were encountered: