2.2.3 • Published 5 years ago
@hckrnews/truth-table v2.2.3
Truth Table package
Generate a truth table very easy. The generated truth tables can be used for e.a. test cases, if you would test a lot of situations.
Installation
npm install @hckrnews/truth-table
or
yarn add @hckrnews/truth-table
Test the package
npm run test
or
yarn test
Usage
Example usage:
import AndTruthTable from "@hckrnews/truth-table";
const table = AndTruthTable.create(3);Table inputs result:
table.inputsOutput:
[
[false, false, false],
[false, false, true],
[false, true, false],
[false, true, true],
[true, false, false],
[true, false, true],
[true, true, false],
[true, true, true],
]To receive results of the and operator:
table.outputOutput:
[false, false, false, false, false, false, false, true]Do you with te receive the result with the inputs of the and operator:
table.resultOutput:
[
[false, false, false, false],
[false, false, false, true],
[false, false, true, false],
[false, false, true, true],
[false, true, false, false],
[false, true, false, true],
[false, true, true, false],
[true, true, true, true],
]All options:
- AndTruthTable
- NandTruthTable
- OrTruthTable
- NorTruthTable
- XoTruthTable
- XnoTruthTable
- XandTruthTable
- XnandTruthTable
- NotTruthTable
To check all used logic gates: https://www.npmjs.com/package/@hckrnews/logic-gates
