{"id":30138309,"url":"https://github.com/nodef/extra-boolean.go","last_synced_at":"2025-08-11T01:06:19.953Z","repository":{"id":57572947,"uuid":"350780007","full_name":"nodef/extra-boolean.go","owner":"nodef","description":"Boolean data type has two possible truth values to represent logic.","archived":false,"fork":false,"pushed_at":"2025-04-10T20:05:50.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T00:47:23.136Z","etag":null,"topics":["algebra","and","boolean","count","eq","extra","imply","logic","select"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/golangf/extra-boolean","language":"Go","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":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-23T16:22:13.000Z","updated_at":"2025-04-10T20:05:54.000Z","dependencies_parsed_at":"2025-04-10T21:21:42.754Z","dependency_job_id":"54faa7b2-28a0-4cc3-a45b-f7ebd58a6ec4","html_url":"https://github.com/nodef/extra-boolean.go","commit_stats":null,"previous_names":["nodef/extra-boolean.go","golangf/extra-boolean"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/nodef/extra-boolean.go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean.go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean.go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean.go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean.go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-boolean.go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-boolean.go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269814828,"owners_count":24479450,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["algebra","and","boolean","count","eq","extra","imply","logic","select"],"created_at":"2025-08-11T01:06:11.902Z","updated_at":"2025-08-11T01:06:19.925Z","avatar_url":"https://github.com/nodef.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Boolean] data type has two possible truth values to represent logic.\u003cbr\u003e\n:package: [GoDev](https://pkg.go.dev/github.com/golangf/extra-boolean),\n:newspaper: [GoDoc](https://pkg.go.dev/github.com/golangf/extra-boolean#section-documentation),\n:blue_book: [Wiki](https://github.com/golangf/extra-boolean/wiki).\n\nHere is my implementation of digital logic gates in software. That 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`). All of them can handle upto 8 inputs.\n\n[Parse] is influenced by [\"boolean\"] package, and is quite good at translating\n`string` to `boolean`. It can also handle double negatives, eg. `not inactive`.\nYou know the [And] of 2-inputs, but what of 1-input? What of 0? And what of\nthe other gates? I answer them here.\n\n\u003e Stability: Experimental.\n\n\u003cbr\u003e\n\n```javascript\nimport (\n  boolean \"github.com/golangf/extra-boolean\"\n)\n\nboolean.Parse(\"1\")\nboolean.Parse(\"truthy\")\nboolean.Parse(\"not off\")\n// true\n\nboolean.Parse(\"not true\")\nboolean.Parse(\"inactive\")\nboolean.Parse(\"disabled\")\n// false\n\nboolean.Imply(true, false)\n// false\n\nboolean.Eq(false, false)\n// true\n\nboolean.Xor3(true, true, true)\n// true\n\nboolean.Select3(1, true, false, true)\n// false                   ^\n\nboolean.Count3(true, false, true)\n// 2            ^            ^\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Name     | Action                                     |\n| -------- | ------------------------------------------ |\n| [Parse]  | Converts string to boolean.                |\n| [Not]    | Checks if value is false.                  |\n| [And]    | Checks if all values are true.             |\n| [Or]     | Checks if any value is true.               |\n| [Xor]    | Checks if odd no. of values are true.      |\n| [Nand]   | Checks if any value is false.              |\n| [Nor]    | Checks if all values are false.            |\n| [Xnor]   | Checks if even no. of values are true.     |\n| [Eq]     | Checks if antecedent ⇔ consequent (a ⇔ b). |\n| [Neq]    | Checks if antecedent ⇎ consequent (a ⇎ b). |\n| [Imply]  | Checks if antecedent ⇒ consequent (a ⇒ b). |\n| [Nimply] | Checks if antecedent ⇏ consequent (a ⇏ b). |\n| [Select] | Checks if ith value is true.               |\n| [Count]  | Counts no. of true values.                 |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [How do I do a case insensitive regular expression in Go?](https://stackoverflow.com/a/15326471/1413259)\n- [Convert string to integer type in Go?](https://stackoverflow.com/a/29841190/1413259)\n- [Set a global variable only once in golang](https://stackoverflow.com/a/38657214/1413259)\n- [GoDoc add newline character](https://stackoverflow.com/q/51641640/1413259)\n- [Indentation is replaced with tabs from spaces on save ...](https://github.com/microsoft/vscode-go/issues/1930)\n- [Testable Examples in Go](https://blog.golang.org/examples)\n- [Godoc: documenting Go code](https://blog.golang.org/godoc)\n- [Optional Parameters in Go?](https://stackoverflow.com/q/2032149/1413259)\n- [Publishing Go Modules](https://blog.golang.org/publishing-go-modules)\n- [Developing and publishing modules](https://golang.org/doc/modules/developing)\n- [Using Go Modules](https://blog.golang.org/using-go-modules)\n- [Go naming conventions for const](https://stackoverflow.com/a/37216200/1413259)\n- [What are conventions for filenames in Go?](https://stackoverflow.com/a/25162021/1413259)\n- [Go Project Structure Best Practices](https://tutorialedge.net/golang/go-project-structure-best-practices/)\n- [Naming Conventions in Go: Short but Descriptive](https://betterprogramming.pub/naming-conventions-in-go-short-but-descriptive-1fa7c6d2f32a)\n- [Effective Go](https://golang.org/doc/effective_go)\n- [How to Write Go Code](https://golang.org/doc/code)\n- [How to fix “go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src”](https://stackoverflow.com/a/59684525/1413259)\n- [Batch Rename](https://marketplace.visualstudio.com/items?itemName=JannisX11.batch-rename-extension)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n[![](https://img.youtube.com/vi/6mMK6iSZsAs/maxresdefault.jpg)](https://www.youtube.com/watch?v=6mMK6iSZsAs)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-boolean.go)\n\n[Boolean]: https://pkg.go.dev/builtin#bool\n[\"boolean\"]: https://www.npmjs.com/package/boolean\n[Parse]: https://github.com/golangf/extra-boolean/wiki/Parse\n[Xor]: https://github.com/golangf/extra-boolean/wiki/Xor\n[Not]: https://github.com/golangf/extra-boolean/wiki/Not\n[And]: https://github.com/golangf/extra-boolean/wiki/And\n[Or]: https://github.com/golangf/extra-boolean/wiki/Or\n[Nand]: https://github.com/golangf/extra-boolean/wiki/Nand\n[Nor]: https://github.com/golangf/extra-boolean/wiki/Nor\n[Xnor]: https://github.com/golangf/extra-boolean/wiki/Xnor\n[Eq]: https://github.com/golangf/extra-boolean/wiki/Eq\n[Imply]: https://github.com/golangf/extra-boolean/wiki/Imply\n[Nimply]: https://github.com/golangf/extra-boolean/wiki/Nimply\n[Select]: https://github.com/golangf/extra-boolean/wiki/Select\n[Count]: https://github.com/golangf/extra-boolean/wiki/Count\n[Neq]: https://github.com/golangf/extra-boolean/wiki/Neq\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-boolean.go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-boolean.go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-boolean.go/lists"}