You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
eeeeeta 7ab501a4be better README and included repository in package.json 8 years ago
README.md better README and included repository in package.json 8 years ago
index.js initial commit, with tests and package.json 8 years ago
package.json better README and included repository in package.json 8 years ago
test.js initial commit, with tests and package.json 8 years ago

README.md

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:

NPM

How do I use it?

It's simple!

var either = require('call-the-whole-thing-off');

var a = "I'm an example!";
var b = false;
if (either(b, a)) {
    console.log(either.which()); // "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)). Magic™!

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 either.which(). You can also use either.all(), which will return all true statements in an array:

if (either.all(true, true, true)) {
    console.log(either.which()) // [true, true, true]
}

Can I have some tests?

Sure:

$ npm test

(you might need to npm install first to install the mocha devDependency)

What's the license?

ISC. I'm pretty relaxed about licensing anyway.