@hckrnews/truth-table

2.2.3 • Public • Published

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.

NPM version Build Status Coveralls Status Scrutinizer Code Quality

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.inputs

Output:

[
    [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.output

Output:

[false, false, false, false, false, false, false, true]

Do you with te receive the result with the inputs of the and operator:

table.result

Output:

[
    [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

Readme

Keywords

Package Sidebar

Install

npm i @hckrnews/truth-table

Weekly Downloads

2

Version

2.2.3

License

AGPL-3.0

Unpacked Size

17.7 kB

Total Files

16

Last publish

Collaborators

  • epeus
  • w3news