- Waterfall checks for:
- truthiness
- falseyness
- equality
- Perks
- built-in argument iteration support for
.t()
and.f()
- built-in pairwise iteration support for
.eq()
andineq
- uses fast-deep equal for
.eq()
andineq()
.can().be().chained()
- just call
.check()
at the end - Returns the result of function / promise
- built-in argument iteration support for
Executes given functions
new Checker()
.t(1, true)
.f(0, false)
.eq(1,1,1,1)
.ineq(1,2)
.pass(() => {
console.log('pass');
})
.fail(() => {
console.log('fail');
})
.check();
// pass
Returns a promise, makes it chainable with then.
new Checker()
.t(1, true)
.f(0, false)
.eq(1,1,1)
.ineq(1,2)
.pass(() => Promise.resolve('pass'))
.fail(() => Promise.reject('fail'))
.check()
.then(() => {
console.log('passed!');
})
.catch(() => {
console.error('failed!');
});
// passed!
To add:
xi() for parseInt()
xf() for parseFloat()
xs() for toString()