Skip to content
Logic gates
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
.jshintrc
.npmignore
LICENSE
README.md
index.js
package.json

README.md

Gates

Gates defines logic gates function for composing more complex functions.

Functions

  • Gates.not
  • Gates.or
  • Gates.and
  • Gates.nor
  • Gates.nand
  • Gates.xor
  • Gates.xnor

Example

var isEven = function(n) { return n % 2 === 0 }
var isNotEven = Gates.not(isEven);

isEven(10); // true
isNotEven(10); // false

var isDivisibleBy3 = function(n) { return n % 3 === 0 }
var isNotEvenAndDivisibleBy3 = Gate.and(isNotEven, isDivisibleBy3)

isNotEvenAndDivisibleBy3(10) // false
isNotEvenAndDivisibleBy3(12) // true
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.