{"id":22945108,"url":"https://github.com/seregpie/lodash.permutations","last_synced_at":"2025-08-12T22:33:19.115Z","repository":{"id":123101135,"uuid":"269321722","full_name":"SeregPie/lodash.permutations","owner":"SeregPie","description":"Calculates all possible permutations without repetition of a certain size.","archived":false,"fork":false,"pushed_at":"2020-06-04T11:55:27.000Z","size":4,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-04T00:33:25.649Z","etag":null,"topics":["array","collection","combinatorics","lodash","mixin","permutation"],"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/SeregPie.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,"publiccode":null,"codemeta":null}},"created_at":"2020-06-04T09:52:47.000Z","updated_at":"2024-05-03T20:26:11.000Z","dependencies_parsed_at":"2023-07-18T13:18:20.404Z","dependency_job_id":null,"html_url":"https://github.com/SeregPie/lodash.permutations","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"b2f2292246177f4b11f919a25134b2c816f2c859"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeregPie%2Flodash.permutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeregPie%2Flodash.permutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeregPie%2Flodash.permutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeregPie%2Flodash.permutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeregPie","download_url":"https://codeload.github.com/SeregPie/lodash.permutations/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229716003,"owners_count":18113023,"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":["array","collection","combinatorics","lodash","mixin","permutation"],"created_at":"2024-12-14T14:29:43.841Z","updated_at":"2024-12-14T14:29:44.514Z","avatar_url":"https://github.com/SeregPie.png","language":"JavaScript","readme":"# lodash.permutations\n\n`_.permutations(collection, n)`\n\nCalculates all possible permutations without repetition of a certain size.\n\n| argument | description |\n| ---: | :--- |\n| `collection` | A collection of distinct values to calculate the permutations from. |\n| `n` | The number of values to combine. |\n\nReturns a new array.\n\n## setup\n\n### npm\n\n```shell\nnpm i lodash.permutations\n```\n\n### ES module\n\n```javascript\nimport 'lodash.permutations';\nimport _ from 'lodash';\n```\n\n### Node\n\n```javascript\nrequire('lodash.permutations');\nlet _ = require('lodash');\n```\n\n### browser\n\n```html\n\u003cscript src=\"https://unpkg.com/lodash\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/lodash.permutations\"\u003e\u003c/script\u003e\n```\n\n## usage\n\n```javascript\nlet permutations = _.permutations([true, {a: 1}, null], 2);\n// =\u003e [[true, {a: 1}], [true, null], [{a: 1}, true], [{a: 1}, null], [null, true], [null, {a: 1}]]\n```\n\n---\n\nCalculate all possible permutations of all possible sizes.\n\n```javascript\nlet permutations = _.flatMap([2, 4, 6], (v, i, a) =\u003e _.permutations(a, i + 1));\n// =\u003e [[2], [4], [6], [2, 4], [2, 6], [4, 2], [4, 6], [6, 2], [6, 4], [2, 4, 6], [2, 6, 4], [4, 2, 6], [4, 6, 2], [6, 2, 4], [6, 4, 2]]\n```\n\n---\n\nAlso accepts array-like values.\n\n```javascript\nlet permutations = _('abc').permutations(3).map(v =\u003e _.join(v, '')).value();\n// =\u003e ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']\n```\n\n## see also\n\n- [lodash.combinations](https://github.com/SeregPie/lodash.combinations)\n- [lodash.multicombinations](https://github.com/SeregPie/lodash.multicombinations)\n- [lodash.multipermutations](https://github.com/SeregPie/lodash.multipermutations)\n- [lodash.product](https://github.com/SeregPie/lodash.product)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseregpie%2Flodash.permutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseregpie%2Flodash.permutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseregpie%2Flodash.permutations/lists"}