{"id":20227767,"url":"https://github.com/kamdz/bin-perm-gen","last_synced_at":"2026-03-04T07:02:26.893Z","repository":{"id":259984355,"uuid":"879975986","full_name":"kamdz/bin-perm-gen","owner":"kamdz","description":"⚡ A fast, zero-dependency generator for creating binary permutations with customizable format and filtering options. ","archived":false,"fork":false,"pushed_at":"2025-05-12T13:38:02.000Z","size":477,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T03:14:39.372Z","etag":null,"topics":["binary","generator","permutations"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/bin-perm-gen","language":"TypeScript","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/kamdz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-10-28T22:17:38.000Z","updated_at":"2025-03-09T16:25:36.000Z","dependencies_parsed_at":"2025-03-09T17:22:19.710Z","dependency_job_id":"2f0d8dad-4cc7-4719-8a47-0209e27a7a46","html_url":"https://github.com/kamdz/bin-perm-gen","commit_stats":null,"previous_names":["kamdz/bin-perm-gen"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/kamdz/bin-perm-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fbin-perm-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fbin-perm-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fbin-perm-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fbin-perm-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamdz","download_url":"https://codeload.github.com/kamdz/bin-perm-gen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamdz%2Fbin-perm-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30075425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T05:31:57.858Z","status":"ssl_error","status_checked_at":"2026-03-04T05:31:38.462Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["binary","generator","permutations"],"created_at":"2024-11-14T07:26:27.183Z","updated_at":"2026-03-04T07:02:26.874Z","avatar_url":"https://github.com/kamdz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔟 Binary Permutations Generator\n\nA fast, zero-dependency generator for creating binary permutations with customizable format and filtering options. The use of **ES6 generators** allows this package to handle large values of `n` efficiently. Permutations are generated on-the-fly, ensuring low memory usage and smooth high performance.\n\n## 🚀 Features\n\n- **Zero dependencies** – simple and lightweight.\n- **Flexible format options** – return results as booleans, numbers, or strings.\n- **Efficient ES6 generator for large `n`** – handles big inputs smoothly, yielding permutations one-by-one.\n- **Custom filters** – control how many `true` values appear in results.\n\n## 🛠️ Installation\n\n```bash\nnpm install bin-perm-gen\n```\n\n## 📖 Usage\n\n```javascript\nimport getBinaryPermutations from 'binary-perm-gen';\n\n// Basic usage with default options\nconst generator = getBinaryPermutations(3);\nfor (const permutation of generator) {\n  console.log(permutation);\n}\n// Output:\n// [ false, false, false ]\n// [ false, false, true ]\n// [ false, true, false ]\n// ...\n\n// Using options\nconst generatorWithOptions = getBinaryPermutations(4, { format: 'string', minOnes: 2 });\nfor (const permutation of generatorWithOptions) {\n  console.log(permutation);\n}\n// Output:\n// '0011'\n// '0101'\n// '0110'\n// '1001'\n// ...\n\n// Convert to array, recommended only for small n parameter\nconst generatedArray = [...getBinaryPermutations(4)];\n```\n\n### Command Line Interface (CLI)\nYou can also use it via the command line:\n\n```bash\nnpx bin-perm-gen 3\n# [\n#   [ false, false, false ],\n#   [ false, false, true ],\n#   [ false, true, false ],\n# ...\n```\n\n## 🔧 API\n\n### `getBinaryPermutations(n: number, options?: Options): Generator\u003cstring | number[] | boolean[]\u003e`\n\nGenerates all binary permutations for `n` bits, allowing customization through the `options` parameter.\n\n- `n` (number): The number of bits (must be a non-negative integer).\n- `options` (optional):\n  - `format` (`'boolean' | 'string' | 'number'`): The output format. Defaults to `'boolean'`.\n  - `minOnes` (number): Minimum number of ones (`true` values) in the result. Defaults to `0`.\n  - `maxOnes` (number): Maximum number of ones (`true` values) in the result. Defaults to `n`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamdz%2Fbin-perm-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamdz%2Fbin-perm-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamdz%2Fbin-perm-gen/lists"}