Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

logical-xor

jacobemerick11MIT0.1.1

Exclusive or, which returns true only when the inputs differ

xor, logical, exclusive or, truthiness

readme

logical-xor

Exclusive or, which returns true only when the inputs differ.

install

npm install logical-xor

usage

Pass in 1 parameter, and it evaluates the truthiness of it.

Pass in 2 parameters, and it returns true only if the inputs evaluate to different booleans.

Pass in more than 2 and it will walk down the chain, left to right, evaluating each set as it goes.

const xor = require('logical-xor');

xor(true, true) // returns false
xor(true, false) // returns true
xor(true) // returns true
xor(true, true, true, false) // return true

tests

npm test