{"id":15785861,"url":"https://github.com/arnaudrinquin/immutable-partition","last_synced_at":"2025-09-22T04:31:45.862Z","repository":{"id":57272824,"uuid":"76722337","full_name":"ArnaudRinquin/immutable-partition","owner":"ArnaudRinquin","description":"A partitioning helper returning ImmutableJS structures","archived":false,"fork":false,"pushed_at":"2016-12-19T09:50:41.000Z","size":41,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T19:43:37.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/immutable-partition","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/ArnaudRinquin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-17T12:15:38.000Z","updated_at":"2018-08-20T15:58:44.000Z","dependencies_parsed_at":"2022-08-25T06:42:08.361Z","dependency_job_id":null,"html_url":"https://github.com/ArnaudRinquin/immutable-partition","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnaudRinquin%2Fimmutable-partition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnaudRinquin%2Fimmutable-partition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnaudRinquin%2Fimmutable-partition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArnaudRinquin%2Fimmutable-partition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArnaudRinquin","download_url":"https://codeload.github.com/ArnaudRinquin/immutable-partition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233824409,"owners_count":18736001,"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":[],"created_at":"2024-10-04T20:41:42.668Z","updated_at":"2025-09-22T04:31:40.563Z","avatar_url":"https://github.com/ArnaudRinquin.png","language":"JavaScript","readme":"# immutable-partition\n\n[![Build Status](https://travis-ci.org/ArnaudRinquin/immutable-partition.svg?branch=master)](https://travis-ci.org/ArnaudRinquin/immutable-partition)\n\nA partitioning helper returning an [`immutablejs`](https://facebook.github.io/immutable-js/) Map of Lists:\n\n\n```js\nimport partition from 'immutable-partition'\n\nconst someNumbers = List.of(0, 1, 2, 3)\nconst evenOrOdd = (number) =\u003e number % 2 === 1 ? 'odd' : 'even'\nconst partitions = partition(evenOrOdd, someNumbers)\nconsole.log(partitions.toString())\n// \u003e Map { \"even\": List [ 0, 2 ], \"odd\": List [ 1, 3 ] }\n```\n\n## Install\n\n```sh\nnpm i -S immutable-partition\n\n# or\n\nyarn add immutable-partition\n```\n\n## Usage\n\n`partition` takes the two following arguments and returns a `Map\u003cK:string, V:List\u003e`.\n\n* `keyForValue(value: any): string` must return a string\n* `reducible` just needs to have a `reduce` function so it can be any `immutablejs` structure, a regular array or anything that acts like one.\n\n`partition` is curried so it can be called in two ways:\n\n```js\npartition(keyForValue, reducible)\n// or\npartition(keyForValue)(reducible)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaudrinquin%2Fimmutable-partition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnaudrinquin%2Fimmutable-partition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaudrinquin%2Fimmutable-partition/lists"}