Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@jaimermxd/logic-gates

A simple package introducing logic gates.

Installation

$ npm install @jaimermxd/logic-gates

Usage

const { AndGate, and, not, NotGate } = require("@jaimermxd/logic-gates");

// Basic gate usage

var andGate = AndGate.create([true, false, true, false, false]);
console.log(andGate.input); // [ true, false, true, false, false ]
console.log(andGate.output); // false

var shortAndGate = and([true, true, true]);
console.log(shortAndGate); // true

var shortNotGate = not([false, true, true, true, false, true]);
console.log(shortNotGate); // [ true, false, false, false, true, false ]

// Truth tables

var xorGate = XorGate.create([false, true]);
console.log(xorGate.truthTable);

/*
[
  [ false, false, false ],
  [ false, true, true ],
  [ true, false, true ],
  [ true, true, false ]
]
*/

var xorTruthTable = XorGate.getTruthTable();
console.log(xorTruthTable);

/*
[
  [ false, false, false ],
  [ false, true, true ],
  [ true, false, true ],
  [ true, true, false ]
]
*/

Documentation

Check out the repository's wiki for a detailed documentation of the package.

Contributing

Pull requests are welcome. For major changes, open an issue first to discuss what you would like to change.

License

Released under the MIT license.

About

A simple package introducing logic gates

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages