{"id":16227162,"url":"https://github.com/oli8/bool-expr-generator","last_synced_at":"2026-02-23T09:37:36.624Z","repository":{"id":98503461,"uuid":"167193489","full_name":"Oli8/bool-expr-generator","owner":"Oli8","description":"A simple generator of boolean expressions","archived":false,"fork":false,"pushed_at":"2021-05-10T09:23:50.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-21T18:12:06.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Oli8.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-23T14:06:46.000Z","updated_at":"2021-05-10T09:23:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"c22a90f8-6e15-43c7-add9-c29d9efd3230","html_url":"https://github.com/Oli8/bool-expr-generator","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"b85c37f60ba6b7d9a79a10995220324207fb0230"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oli8%2Fbool-expr-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oli8%2Fbool-expr-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oli8%2Fbool-expr-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Oli8%2Fbool-expr-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Oli8","download_url":"https://codeload.github.com/Oli8/bool-expr-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238772144,"owners_count":19527880,"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-10T12:51:49.610Z","updated_at":"2025-10-29T05:30:19.566Z","avatar_url":"https://github.com/Oli8.png","language":"JavaScript","readme":"# bool-expr-generator\n\nA simple generator of boolean expressions.  \n\n## Installation\n#### NPM\n```shell\nnpm install --save bool-expr-generator\n```\n\n## Usage\n\n```js\nimport BoolExpr from 'bool-expr-generator';\nconst boolGenerator = new BoolExpr();\nconst expr = boolGenerator.generate(); // 'true \u0026\u0026 false'\n\n// You may pass an option object to the constructor\nconst boolGenerator = new BoolExpr({\n\tcomplexity: 3,\n\toperators: [\"||\", \"\u0026\u0026\", \"^\"],\n\toperatorsDisplayed: {\"^\": \"XOR\", \"\u0026\u0026\": \"AND\", \"||\": \"OR\"},\n\tlogicalValues: [true, false, 0, 1],\n\tinvertedValue: true,\n});\nconst expr = boolGenerator.generate(); // 'false XOR 1 OR true'\n// If cou customised the operatorsDisplayed option you can use the convert method to convert the expression into an evaluable one\nconsole.log(boolGenerator.convert(expr)); // 'false ^ 1 || true'\n// Update options:\nboolGenerator.options({complexity: 4});\nconsole.log(boolGenerator.generate()); // true XOR 1 AND !0 OR !0\n\n// You can also use a nested expression with or without its own options\nconst boolGenerator = new BoolExpr({\n\tlogicalValues: [true, false, BoolExpr.nestedExpr({complexity: 2, logicalValues: [0, 1]})], // Note that it is advised to specify the logicalValues\n});\nconst expr = boolGenerator.generate(); // 'false \u0026\u0026 (0 || 1)'\n```\n\n### Option object  \n| Key  | Type | Default | Example | Description |\n| ------------- | ------------- | ------------- | ------------- | ------------- |\n| complexity | `integer` \\| `Array\u003cinteger\u003e` | 2  | `3` \\| `[2, 4]` | Length of the expression, if an array is supplied the complexity will be a random value of it |\n| operators | `Array\u003cstring\u003e`  | `['\\|\\|', '\u0026\u0026']` | `['\\|\\|', '\u0026\u0026', '^']` | The logical operators to be used |\n| operatorsDisplayed | `Object`  | `{}` | `{'^': 'XOR'}` | How the operators will be displayed in the expresssion |\n| logicalValues | `Array`  | `[true, false]` | `[0, 1, true, false]` | The logical values that can be included into the expression |\n| invertedValue | `boolean` \\| `float`  | `false` | `true` \\| `.3` | Whether to add the inverted logical values or probability to have an inverted value for each logical values |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foli8%2Fbool-expr-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foli8%2Fbool-expr-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foli8%2Fbool-expr-generator/lists"}