{"id":21831334,"url":"https://github.com/nodef/extra-boolean","last_synced_at":"2026-02-27T11:39:18.409Z","repository":{"id":33838750,"uuid":"162931162","full_name":"nodef/extra-boolean","owner":"nodef","description":"Boolean data type has two possible truth values to represent logic.","archived":false,"fork":false,"pushed_at":"2025-04-08T17:14:04.000Z","size":641,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T21:48:34.363Z","etag":null,"topics":["algebra","and","boolean","count","eq","extra","imply","is","logic","nand","neq","nimply","nor","not","or","parse","select","xnor","xor"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-boolean","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/nodef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-12-23T23:32:31.000Z","updated_at":"2025-04-08T17:14:05.000Z","dependencies_parsed_at":"2025-04-12T08:15:30.158Z","dependency_job_id":"7f5856d5-b564-4efa-91c1-405e59b7b999","html_url":"https://github.com/nodef/extra-boolean","commit_stats":{"total_commits":166,"total_committers":2,"mean_commits":83.0,"dds":"0.0060240963855421326","last_synced_commit":"0e24580b5a1ad4dbd93ff3945bc1039ad29721b2"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nodef/extra-boolean","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-boolean/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265496011,"owners_count":23776726,"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":["algebra","and","boolean","count","eq","extra","imply","is","logic","nand","neq","nimply","nor","not","or","parse","select","xnor","xor"],"created_at":"2024-11-27T19:09:43.977Z","updated_at":"2026-02-27T11:39:13.378Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","readme":"[Boolean] data type has two possible truth values to represent logic.\u003cbr\u003e\n📦 [Node.js](https://www.npmjs.com/package/extra-boolean),\n🌐 [Web](https://www.npmjs.com/package/extra-boolean.web),\n📜 [Files](https://unpkg.com/extra-boolean/),\n📰 [Docs](https://nodef.github.io/extra-boolean/).\n📘 [Wiki](https://github.com/nodef/extra-boolean/wiki/).\n\nA **boolean** data type has two possible truth values, usually represented as\n`true` or `false`. It is named after *George Boole*, who first defined an\nalgebraic system of logic in the mid 19th century [(REF)][01wiki]. Boolean\nfunctions can be used to perform logical operations in computer programming,\nsuch as in conditional statements, loops, and branching, to compare input values\nwith a set of rules to determine the output.\n\nThis is a collection of common boolean functions. It includes\nthe basic gates [not], [and], [or], [xor]; their complements [nand], [nor],\n[xnor]; and 2 propositional logic (taught in discrete mathematics) gates\n[imply], [eq]; and their complements [nimply], [neq]. There is also a\nmultiplexer, called [select], and a `true` counter, called [count]. [count]\ncan help you make custom gates, such as an *alternate* concept of **xnor**\nwhich returns `true` only if all inputs are the same (standard [xnor] returns\n`true` if even inputs are `true`). These gates can handle up to eight inputs.\n\nThe [parse] function is influenced by [(boolean)] package, and is quite good at\ntranslating `string` to `boolean`. It can also handle double negatives, eg.\n`not inactive`. You know the [and] of 2-inputs, but what of 1-input? What of 0?\nAnd what of the other gates? I answer them here.\n\nThis package is available in *Node.js* and *Web* formats. To use it on the web,\nsimply use the `extra_boolean` global variable after loading with a `\u003cscript\u003e`\ntag from the [jsDelivr CDN].\n\n[01wiki]: https://en.wikipedia.org/wiki/Boolean_data_type\n[Boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n[(boolean)]: https://www.npmjs.com/package/boolean\n[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-boolean.web/index.js\n\n\u003e Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).\n\n\u003cbr\u003e\n\n```javascript\nconst xboolean = require('extra-boolean');\n// import * as xboolean from \"extra-boolean\";\n// import * as xboolean from \"https://unpkg.com/extra-boolean/index.mjs\"; (deno)\n\nxboolean.parse('1');\nxboolean.parse('not off');\nxboolean.parse('truthy');\n// → true\n\nxboolean.parse('not true');\nxboolean.parse('inactive');\nxboolean.parse('disabled');\n// → false\n\nxboolean.imply(true, false);\n// → false\n\nxboolean.eq(false, false);\n// → true\n\nxboolean.xor(true, true, true);\n// → true\n\nxboolean.select(1, true, false, true);\n// → false                ^\n\nxboolean.count(true, false, true);\n// → 2         ^            ^\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Property | Description |\n|  ----  |  ----  |\n| [is] | Check if a value is boolean. |\n| [parse] | Convert a string to boolean. |\n|  |  |\n| [not] | Check if a boolean is false. |\n| [imply] | Check if antecedent ⇒ consequent. |\n| [nimply] | Check if antecedent ⇏ consequent. |\n| [eq] | Check if antecedent ⇔ consequent. |\n| [neq] | Check if antecedent ⇎ consequent. |\n|  |  |\n| [and] | Check if all booleans are true. |\n| [nand] | Check if any boolean is false. |\n| [or] | Check if any boolean is true. |\n| [nor] | Check if all booleans are false. |\n| [xor] | Check if odd number of booleans are true. |\n| [xnor] | Check if even number of booleans are true. |\n|  |  |\n| [count] | Count number of true booleans. |\n| [select] | Check if iᵗʰ boolean is true. |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [boolean package : Golo Roden and contributors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference)\n- [MDN Web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://img.youtube.com/vi/6mMK6iSZsAs/maxresdefault.jpg)](https://www.youtube.com/watch?v=6mMK6iSZsAs)\u003cbr\u003e\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n[![DOI](https://zenodo.org/badge/162931162.svg)](https://zenodo.org/badge/latestdoi/162931162)\n[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-boolean/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-boolean?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/4df603a5ea361f324e9f/test_coverage)](https://codeclimate.com/github/nodef/extra-boolean/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/4df603a5ea361f324e9f/maintainability)](https://codeclimate.com/github/nodef/extra-boolean/maintainability)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-boolean)\n\n[is]: https://github.com/nodef/extra-boolean/wiki/is\n[parse]: https://github.com/nodef/extra-boolean/wiki/parse\n[not]: https://github.com/nodef/extra-boolean/wiki/not\n[imply]: https://github.com/nodef/extra-boolean/wiki/imply\n[nimply]: https://github.com/nodef/extra-boolean/wiki/nimply\n[eq]: https://github.com/nodef/extra-boolean/wiki/eq\n[neq]: https://github.com/nodef/extra-boolean/wiki/neq\n[and]: https://github.com/nodef/extra-boolean/wiki/and\n[nand]: https://github.com/nodef/extra-boolean/wiki/nand\n[or]: https://github.com/nodef/extra-boolean/wiki/or\n[nor]: https://github.com/nodef/extra-boolean/wiki/nor\n[xor]: https://github.com/nodef/extra-boolean/wiki/xor\n[xnor]: https://github.com/nodef/extra-boolean/wiki/xnor\n[count]: https://github.com/nodef/extra-boolean/wiki/count\n[select]: https://github.com/nodef/extra-boolean/wiki/select\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-boolean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-boolean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-boolean/lists"}