An open API service indexing awesome lists of open source software.

https://github.com/virtualstate/combinational


https://github.com/virtualstate/combinational

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# `@virtualstate/combinational`

This project is in semver alpha stage

[//]: # (badges)

### Support

![Node.js supported](https://img.shields.io/badge/node-%3E%3D16.0.0-blue) ![Deno supported](https://img.shields.io/badge/deno-%3E%3D1.17.0-blue)

### Test Coverage

![100%25 lines covered](https://img.shields.io/badge/lines-100%25-brightgreen) ![100%25 statements covered](https://img.shields.io/badge/statements-100%25-brightgreen) ![100%25 functions covered](https://img.shields.io/badge/functions-100%25-brightgreen) ![100%25 branches covered](https://img.shields.io/badge/branches-100%25-brightgreen)

[//]: # (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)