Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

promise.allsettled polyfill node

Promise.allSettled = function (promises) {
  let mappedPromises = promises.map((p) => {
    return p      
      .then((value) => {        
        return {          
          status: 'fulfilled',         
          value,        
        };      
      })      
      .catch((reason) => {        
        return {          
          status: 'rejected',        
          reason,        
        };      
      });  
    });  
  return Promise.all(mappedPromises);};
Source by 95yashsharma.medium.com #
 
PREVIOUS NEXT
Tagged: #polyfill #node
ADD COMMENT
Topic
Name
9+3 =