How to use p-all - 1 common examples

To help you get started, we’ve selected a few p-all 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 smblee / parameter-store-manager / app / ducks / parameters.js View on Github external
return map;
        }, {});

        return [mapping, data.InvalidParameters];
      })
      .catch(err => {
        console.error('Something went wrong while fetching parameters', err);

        dispatch({
          type: FETCH_PARAMETER_VALUES_FAILURE,
          payload: names
        });
      })
  ); // end of chunk calls

  return pAll(getParameterRequestActions, { concurrency: 2 }).then(
    bulkResults => {
      // res will be a list of [mapping, invalidParameters]
      const nameValueMapping = bulkResults.reduce(
        (map, r) => ({ ...map, ...r[0] }),
        {}
      );
      dispatch({
        type: FETCH_PARAMETER_VALUES_SUCCESS,
        payload: { names: Object.keys(nameValueMapping), nameValueMapping }
      });

      const invalidParameters = bulkResults.reduce(
        (lst, r) => [...lst, ...r[1]],
        []
      );

p-all

Run promise-returning & async functions concurrently with optional limited concurrency

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Popular p-all functions