validate.js
function(results) {
      // Create a sequence of all the results starting with a resolved promise.
      return results.reduce(function(memo, result) {
        // If this result isn't a promise skip it in the sequence.
        if (!v.isPromise(result.error)) {
          return memo;
        }

        return memo.then(function() {
          return result.error.then(function(error) {
            result.error = error || null;
          });
        });
      }, new v.Promise(function(r) { r(); })); // A resolved promise
    }
function(results) {
      // Create a sequence of all the results starting with a resolved promise.
      return results.reduce(function(memo, result) {
        // If this result isn't a promise skip it in the sequence.
        if (!v.isPromise(result.error)) {
          return memo;
        }

        return memo.then(function() {
          return result.error.then(function(error) {
            result.error = error || null;
          });
        });
      }, new v.Promise(function(r) { r(); })); // A resolved promise
    }
function ( results ) { // Create a sequence of all the results starting with a resolved promise. return results . reduce ( function ( memo , result ) { // If this result isn't a promise skip it in the sequence. if ( ! v . isPromise ( result . error ) ) { return memo ; } return memo . then ( function ( ) { return result . error . then ( function ( error ) { result . error = error || null ; } ) ; } ) ; } , new v . Promise ( function ( r ) { r ( ) ; } ) ) ; // A resolved promise }
Returns a promise that is resolved when all promises in the results array are settled. The promise returned from this function is always resolved, never rejected. This function modifies the input argument, it replaces the promises with the value returned from the promise.
Returns a promise that is resolved when all promises in the results array are settled . The promise returned from this function is always resolved never rejected . This function modifies the input argument it replaces the promises with the value returned from the promise .