News for hackers. Stuff that matters.
Re:101 – A JavaScript utility library by vlunkr on Monday November 24, 2014 @04:02PM (#8654731)
var and = require('101/and');

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

Re:101 – A JavaScript utility library by city41 on Monday November 24, 2014 @04:42PM (#8654905)
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()

https://github.com/tjmehta/101/blob/master/test/test-and.js

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');
    });