Use “Is” to flatten out your if-then-else logic flow and handle exceptions
Convert nested and possibly repeated if-then-else statement with this example:
var foo = 'bar';
Is(foo)
.longerThan(0)
.equalTo('bar')
.not.equalTo('bar2')
.then(() => {
console.log('success');
})
.catch(() => {
throw new Error('bad foo');
});
Read more at github.com