Let's Call the Whole Thing Off
♪ You say /ˈiːð.ə(ɹ)/ and I say /ˈaɪð.ə(ɹ)/ ♪
What is this thing?
Have you ever been writing code like this:
if a || b// which one was it?
...and wanted to get which value was eventually used in your
|| OR statement?
Well, Let's Call the Whole Thing Off is for you!
How do I download it?
Through the magic of npm:
How do I use it?
var either = ;var a = "I'm an example!";var b = false;ifconsole; // "I'm an example!"
Just replace your
|| statement with
either(a, b, c.... So for
if (oh || my || god), you would put
if (either(oh, my, god)).
But what if there's more than one true statement?
either() will take the first statement that is true (would pass an
if ()) and make it available to
You can also use
either.all(), which will return all true statements in an array:
if eitheralltrue true trueconsole // [true, true, true]
Can I have some tests?
$ npm test
(you might need to
npm install first to install the
What's the license?
ISC. I'm pretty relaxed about licensing anyway.