I'm not convinced either. But for what it's worth, the tests for and() and or() essentially treat them as some() and all() using reduce()
Re:101 – A JavaScript utility library
by abelnation on Monday November 24, 2014 @06:34PM
(#8655359)
Providing an function version of `&&` let's you use that function in more FP (functional programming) contexts, e.g. a data transform that does multiple map/apply/reduce transforms to a data set.
Re:101 – A JavaScript utility library
by noisysocks on Monday November 24, 2014 @11:43PM
(#8656373)
A silly example:
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var and = require('101/and');
var paths = [...];
Promise.map(paths, fs.existsAsync).reduce(and)
.then(function(allExist) {
if (allExist) console.log('all paths exist');
});
and(true, false); // false
and(true, true); // true
I'm not convinced that there's a real need for that. Anyone else have a good use for something like that? Looks like it doesn't even take more than two arguments