Javascript 如何有效地使用蓝知更鸟?

Javascript 如何有效地使用蓝知更鸟?,javascript,promise,bluebird,Javascript,Promise,Bluebird,我有一系列的承诺,我需要等待,直到所有的承诺兑现或拒绝。 这就是我正在做的 var = [promiseA,promiseB,promiseC] Promise.all(promises.map(function(promise) {
 return promise.reflect();
 })).each(function(inspection) {
 if (inspection.isFulfilled()) {


我有一系列的承诺,我需要等待,直到所有的承诺兑现或拒绝。 这就是我正在做的

var = [promiseA,promiseB,promiseC]      
    Promise.all(promises.map(function(promise) {
     
       return promise.reflect();
    
    })).each(function(inspection) {
     
    if (inspection.isFulfilled()) {
    
    console.log("A promise in the array was fulfilled   with",inspection.value());
       
   } else {

      console.error("A promise in the array was 
       rejected with",  inspection.reason());
     
    }
       
 })
上面的代码打印每个承诺的已实现或已拒绝值。在我的例子中,这里的每个承诺都返回一个成功或错误json。我需要使用类似.then()的函数获取所有成功的json值

当我尝试使用获取值时。然后

Promise.all(promises.map(function(promise) {
      
   return promise.reflect();
   
 })).then(data){
//_settledValue gives me the json value either success json or error json
   console.log('data[0]::::’+JSON.stringify(data[0]._settledValue));    
}.
我将如何忽略错误json并在此处仅获取成功json?
有人能帮我解决这个问题吗?

按照其他人的建议使用
Array.filter
Bluebird.filter

Bluebird.all(promises.map(function(promise) {
          
  return promise.reflect();
       
}))
  .filter(function(promise) {return promise.isFulfilled();})
  // or .then(promises => promises.filter(/*...*/))
  .then(function (data) {
     // only successful ones are available here...
  });

如果异步方法的返回结果没有真正抛出错误,而是返回一个表示这是错误的字符串,那么您可能必须通过检查该字符串来处理,因为承诺无法读取<我想到了代码>数组.过滤器,但如果您也想看到所有异常呢?