{"id":19197010,"url":"https://github.com/jitesoft/js-group-by","last_synced_at":"2025-08-31T14:33:35.619Z","repository":{"id":38419406,"uuid":"219327193","full_name":"jitesoft/js-group-by","owner":"jitesoft","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-24T15:14:18.000Z","size":3031,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-04T10:08:51.318Z","etag":null,"topics":["function","group-by","grouping","hacktoberfest","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jitesoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-11-03T16:04:56.000Z","updated_at":"2022-04-27T14:52:52.000Z","dependencies_parsed_at":"2023-12-26T15:50:59.187Z","dependency_job_id":null,"html_url":"https://github.com/jitesoft/js-group-by","commit_stats":null,"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fjs-group-by","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fjs-group-by/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fjs-group-by/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fjs-group-by/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jitesoft","download_url":"https://codeload.github.com/jitesoft/js-group-by/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271531,"owners_count":19774859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["function","group-by","grouping","hacktoberfest","javascript"],"created_at":"2024-11-09T12:15:15.615Z","updated_at":"2025-02-23T04:45:19.579Z","avatar_url":"https://github.com/jitesoft.png","language":"JavaScript","funding_links":["https://opencollective.com/jitesoft-open-source"],"categories":[],"sub_categories":[],"readme":"# Group By\n\n[![npm (scoped)](https://img.shields.io/npm/v/@jitesoft/group-by)](https://www.npmjs.com/package/@jitesoft/group-by)\n[![Known Vulnerabilities](https://dev.snyk.io/test/npm/@jitesoft/group-by/badge.svg)](https://dev.snyk.io/test/npm/@jitesoft/group-by)\n[![pipeline status](https://gitlab.com/jitesoft/open-source/javascript/group-by/badges/master/pipeline.svg)](https://gitlab.com/jitesoft/open-source/javascript/group-by/commits/master)\n[![coverage report](https://gitlab.com/jitesoft/open-source/javascript/group-by/badges/master/coverage.svg)](https://gitlab.com/jitesoft/open-source/javascript/group-by-by/commits/master)\n[![npm](https://img.shields.io/npm/dt/@jitesoft/group-by)](https://www.npmjs.com/package/@jitesoft/group-by)\n[![Back project](https://img.shields.io/badge/Open%20Collective-Tip%20the%20devs!-blue.svg)](https://opencollective.com/jitesoft-open-source)\n\nSimple method to group an array by a given key in the array. The method uses a callback function to choose the \nvalue to group the values by and returns an object which have all the ordered values in an array under the given key name.\n\n## Example:\n\n```js\nimport groupBy from '@jitesoft/group-by';\n\nlet array = [ { \"id\": \"abc\", \"value\": \"abc\" },\n              { \"id\": \"abc\", \"value\": \"def\" },\n              { \"id\": \"abc\", \"value\": \"ghi\" },\n              { \"id\": \"def\", \"value\": \"abc\" },\n              { \"id\": \"def\", \"value\": \"def\" },\n              { \"id\": \"ghi\", \"value\": \"abc\" } ];\n\nlet result = groupBy(array, (obj) =\u003e obj.id);\n\n// Output:\nlet obj = {\n       abc: [\n         { \"id\": \"abc\", \"value\": \"abc\" },\n         { \"id\": \"abc\", \"value\": \"def\" },\n         { \"id\": \"abc\", \"value\": \"ghi\" }\n       ],\n       def: [\n         { \"id\": \"def\", \"value\": \"abc\" },\n         { \"id\": \"def\", \"value\": \"def\" }\n       ],\n       ghi: [\n         { \"id\": \"ghi\", \"value\": \"abc\" }\n       ]\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fjs-group-by","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjitesoft%2Fjs-group-by","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fjs-group-by/lists"}