UNPKG

human-logic

Version:
75 lines (74 loc) 2.59 kB
/** * Discrete Common Sense Logic * * Discrete Common Sense Logic only allows `true`, `false`, `maybe`, `never` or `undefined` as a value. * @module */ /** * Discrete Logical Category of “totally unknown” */ export declare const UNDEF: "UNDEF"; /** * Discrete Logical Category of “certainly negative” */ export declare const FALSE: "FALSE"; /** * Discrete Logical Category of “impossible” (neither positive nor negative) */ export declare const NEVER: "NEVER"; /** * Discrete Logical Category of “uncertain” (could be either positive or negative) */ export declare const MAYBE: "MAYBE"; /** * Discrete Logical Category of “certainly positive” */ export declare const TRUE: "TRUE"; /** * List of all five categories. * * Useful to iterate through all five logical categories. */ export declare const Categories: readonly ["UNDEF", "FALSE", "NEVER", "MAYBE", "TRUE"]; /** * Base Discrete Common Sense Logic type. * * * `UNDEF` – Totally unknown * * `FALSE` – Certainly negative * * `NEVER` – Impossible (neither positive nor negative) * * `MAYBE` – Uncertain (could be either positive or negative) * * `TRUE` – Certainly positive */ export type Category = 'UNDEF' | 'FALSE' | 'NEVER' | 'MAYBE' | 'TRUE'; /** * Discrete Logical NOT: * * | `undef` | `false` | `never` | `maybe` | `true` | * | --- | --- | --- | --- | --- | * | `undef` | `true` | `maybe` | `never` | `false` | */ export declare function not(value: Category): Category; /** * Discrete Logical AND: * * | `a` \ `b` | `undef` | `false` | `never` | `maybe` | `true` | * | --- | --- | --- | --- | --- | --- | * | **`undef`** | `undef` | `undef` | `undef` | `undef` | `undef` | * | **`false`** | `undef` | `false` | `false` | `false` | `false` | * | **`never`** | `undef` | `false` | `never` | `false` | `never` | * | **`maybe`** | `undef` | `false` | `false` | `maybe` | `maybe` | * | **`true`** | `undef` | `false` | `never` | `maybe` | `true` | */ export declare function and(a: Category, b: Category): Category; /** * Discrete Logical OR: * * | `a` \ `b` | `undef` | `false` | `never` | `maybe` | `true` | * | --- | --- | --- | --- | --- | --- | * | **`undef`** | `undef` | `undef` | `undef` | `undef` | `undef` | * | **`false`** | `undef` | `false` | `never` | `maybe` | `true` | * | **`never`** | `undef` | `never` | `never` | `true` | `true` | * | **`maybe`** | `undef` | `maybe` | `true` | `maybe` | `true` | * | **`true`** | `undef` | `true` | `true` | `true` | `true` | */ export declare function or(a: Category, b: Category): Category;