{"id":19233002,"url":"https://github.com/welingtonms/logical","last_synced_at":"2026-06-10T20:31:56.185Z","repository":{"id":36987550,"uuid":"339131639","full_name":"welingtonms/logical","owner":"welingtonms","description":"Execute, chain \u0026 compose logical operations.","archived":false,"fork":false,"pushed_at":"2023-02-04T13:24:50.000Z","size":966,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-31T02:27:42.367Z","etag":null,"topics":["and","boolean","boolean-logic","javascript","logic-gates","logical-operators","nand","or","xor"],"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/welingtonms.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}},"created_at":"2021-02-15T16:08:31.000Z","updated_at":"2022-06-19T23:26:52.000Z","dependencies_parsed_at":"2023-02-18T16:40:17.224Z","dependency_job_id":null,"html_url":"https://github.com/welingtonms/logical","commit_stats":null,"previous_names":["cheesebit/logical"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/welingtonms/logical","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welingtonms%2Flogical","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welingtonms%2Flogical/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welingtonms%2Flogical/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welingtonms%2Flogical/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/welingtonms","download_url":"https://codeload.github.com/welingtonms/logical/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welingtonms%2Flogical/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34170162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":["and","boolean","boolean-logic","javascript","logic-gates","logical-operators","nand","or","xor"],"created_at":"2024-11-09T16:08:24.028Z","updated_at":"2026-06-10T20:31:56.159Z","avatar_url":"https://github.com/welingtonms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logical\n\n[![Coverage Status](https://img.shields.io/coveralls/github/welingtonms/logical?style=flat-square)](https://coveralls.io/github/welingtonms/logical)\n[![npm package](https://img.shields.io/npm/v/@welingtonms/logical?style=flat-square)](https://www.npmjs.com/package/@welingtonms/logical)\n[![Run tests](https://github.com/welingtonms/logical/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/welingtonms/logical/actions/workflows/test.yml)\n\nI have always been fascinated by the simplicity of logical operations and how you can express complex logical structures using it.\n\nThat's why I wrote this library, to provides a toolset to perform and chain logical operations.\n\nIt follows Javascript's default [_truthy_](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) and [_falsy_](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) definitions.\n\n## Instalation\n\nYou can add this hook as a dependency by running `npm install @welingtonms/logical` or `yarn add @welingtonms/logical`.\n\n## Supported operations\n\n### AND\n\n-   Accepts multiple parameters. Evaluation occurs from left to right.\n\n```js\nimport { and } from '@welingtonms/logical';\n\nand( true, true, true ); // true\nand( true, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  |  `true` |\n| `true`  | `false` | `false` |\n| `false` | `true`  | `false` |\n| `false` | `false` | `false` |\n\n### OR\n\n-   Accepts multiple parameters. Evaluation occurs from left to right.\n\n```js\nimport { or } from '@welingtonms/logical';\n\nor( false, false, true ); // true\nor( false, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  |  `true` |\n| `true`  | `false` |  `true` |\n| `false` | `true`  |  `true` |\n| `false` | `false` | `false` |\n\n### XOR\n\n-   Accepts two parameters.\n\n```js\nimport { xor } from '@welingtonms/logical';\n\nxor( true, false ); // true\nxor( false, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  | `false` |\n| `true`  | `false` |  `true` |\n| `false` | `true`  |  `true` |\n| `false` | `false` | `false` |\n\n### NOT\n\n-   Accepts one parameter.\n\n```js\nimport { not } from '@welingtonms/logical';\n\nxor( true, false ); // true\nxor( false, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  |  `true` |\n| `true`  | `false` |  `true` |\n| `false` | `true`  |  `true` |\n| `false` | `false` | `false` |\n\n### NAND\n\n-   Accepts multiple parameters. Evaluation occurs from left to right.\n\n```js\nimport { nand } from '@welingtonms/logical';\n\nnand( true, true, true ); // true\nnand( true, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  | `false` |\n| `true`  | `false` |  `true` |\n| `false` | `true`  |  `true` |\n| `false` | `false` |  `true` |\n\n### NOR\n\n-   Accepts multiple parameters. Evaluation occurs from left to right.\n\n```js\nimport { nor } from '@welingtonms/logical';\n\nnor( true, true, true ); // true\nnor( true, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  | `false` |\n| `true`  | `false` | `false` |\n| `false` | `true`  | `false` |\n| `false` | `false` |  `true` |\n\n### XNOR\n\n-   Accepts two parameters.\n\n```js\nimport { xnor } from '@welingtonms/logical';\n\nxnor( true, false ); // true\nxnor( false, false ); // false\n```\n\n| A       |    B    |  Output |\n| ------- | :-----: | ------: |\n| `true`  | `true`  |  `true` |\n| `true`  | `false` | `false` |\n| `false` | `true`  | `false` |\n| `false` | `false` |  `true` |\n\n## Usage guide\n\nYou can also chain operations using default export `logical`.\n\nFirst you need to call it with the appropriate initial value (which will depend on the operations you will perform).\n\nWhen you are done chaining operations, you can call `value()` to get the result.\n\n```js\nimport logical from '@welingtonms/logical';\n\nconsole.log( logical( true ).value() ); // true\nconsole.log( logical( false ).value() ); // false\n\nconsole.log( logical( true ).xor( false ).value() ); // true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwelingtonms%2Flogical","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwelingtonms%2Flogical","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwelingtonms%2Flogical/lists"}