https://github.com/virtualstate/combinational
https://github.com/virtualstate/combinational
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/virtualstate/combinational
- Owner: virtualstate
- License: mit
- Created: 2022-06-18T06:30:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-11T11:53:49.000Z (almost 4 years ago)
- Last Synced: 2025-10-08T08:31:18.252Z (9 months ago)
- Language: TypeScript
- Size: 249 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE-OF-CONDUCT.md
Awesome Lists containing this project
README
# `@virtualstate/combinational`
This project is in semver alpha stage
[//]: # (badges)
### Support
 
### Test Coverage
   
[//]: # (badges)
[//]: # (src/trying-to-write-documentation/combinational-how.tsx)
import {ok, h, descendants} from "@virtualstate/focus";
import {
And,
Boolean,
isBooleanFalseArray,
isBooleanTrueArray, Nand,
Nor,
Not,
Or,
Xnor,
Xor
} from "@virtualstate/combinational";
/**
* This is living documentation, change this code, and on build, README.md will be updated
*
* Comments starting with /* (and not /**) will be treated as markdown
* Code is treated as codeblocks
*
* To split code up, add an empty comment
* A comment must have its starting & ending markers on their own lines
# Hello
```typescript jsx
const nodeTrue = {true}
const nodeTrueNumber = {1}
const nodeTrueString = {" "}
const nodeTrueNode =
const nodeFalse = {false}
const nodeFalseNumber = {0}
const nodeFalseString = {""}
async function assertTrue(input: unknown): Promise {
const booleans = await descendants(input);
ok(isBooleanTrueArray(booleans), `expected all to be true, got ${booleans}`);
}
async function assertFalse(input: unknown): Promise {
const booleans = await descendants(input);
ok(isBooleanFalseArray(booleans), `expected all to be false, got ${booleans}`);
}
await assertTrue(nodeTrue);
await assertTrue(nodeTrueNumber);
await assertTrue(nodeTrueString);
await assertTrue(nodeTrueNode);
await assertFalse(nodeFalse);
await assertFalse(nodeFalseNumber);
await assertFalse(nodeFalseString);
const nodeAndTrue = (
{nodeTrue}
{nodeTrueNumber}
{nodeTrueString}
{nodeTrueNode}
{true}
{" "}
{1}
)
const nodeAndFalse = (
{nodeAndTrue}
{false}
);
await assertFalse();
await assertTrue(nodeAndTrue);
await assertFalse(nodeAndFalse);
const not = (
{nodeAndTrue}
)
const notTrue = (
{nodeAndFalse}
);
await assertTrue();
await assertFalse(not);
await assertTrue(notTrue);
const or = (
{nodeAndTrue}
{nodeAndFalse}
)
const orFalse = (
{nodeFalse}
{nodeAndFalse}
);
await assertFalse();
await assertTrue(or);
await assertFalse(orFalse);
const nor = (
{nodeAndTrue}
{nodeAndFalse}
)
const norTrue = (
{nodeFalse}
{nodeAndFalse}
);
await assertTrue();
await assertFalse(nor);
await assertTrue(norTrue);
const xor = (
{false}
{nodeFalse}
)
await assertFalse();
await assertFalse(xor);
const xorTrueOne = (
{nodeFalse}
{nodeTrue}
)
const xorTrueOther = (
{nodeAndTrue}
{orFalse}
);
await assertTrue(xorTrueOne);
await assertTrue(xorTrueOther);
const xorFalseAll = (
{nodeAndTrue}
{true}
{nodeTrueString}
);
await assertFalse(xorFalseAll);
const xnor = (
{false}
{nodeFalse}
{nodeAndFalse}
{orFalse}
);
await assertTrue();
await assertTrue(xnor);
const xnorTrue = (
{true}
{nodeTrue}
{nodeAndTrue}
{or}
);
await assertTrue(xnorTrue);
const xnorFalse = (
{true}
{nodeFalse}
{nodeAndTrue}
{or}
);
await assertFalse(xnorFalse);
const xnorFalseOther = (
{true}
{nodeFalse}
{nodeAndTrue}
{orFalse}
);
await assertFalse(xnorFalseOther);
const nand = (
{false}
{nodeFalse}
{orFalse}
);
await assertTrue();
await assertTrue(nand);
const nandTrue = (
{true}
{nodeFalse}
{orFalse}
);
await assertTrue(nandTrue);
const nandTrueOther = (
{true}
{nodeAndTrue}
{orFalse}
);
await assertTrue(nandTrueOther);
const nandTrueAnother = (
{true}
{nodeAndTrue}
{orFalse}
{or}
);
await assertTrue(nandTrueAnother);
const nandFalse = (
{true}
{nodeAndTrue}
{nodeTrue}
{or}
);
await assertFalse(nandFalse);
```
[//]: # (src/trying-to-write-documentation/combinational-how.tsx)