How to use p-reflect - 1 common examples

To help you get started, we’ve selected a few p-reflect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keystonejs / keystone / packages / utils / src / index.js View on Github external
const allPromises = Object.keys(obj).map(key =>
    pReflect(obj[key]).then(val => {
      if (val.isFulfilled) {
        returnValue[key] = val.value;
      } else if (val.isRejected) {
        errors[key] = val.reason;
      }

      return val;
    })
  );

p-reflect

Make a promise always fulfill with its actual fulfillment value or rejection reason

MIT
Latest version published 10 months ago

Package Health Score

68 / 100
Full package analysis

Popular p-reflect functions

Popular JavaScript code snippets

Find secure code to use in your application or website