@unction/allobjectp
TypeScript icon, indicating that this package has built-in type declarations

13.15.0 • Public • Published

@unction/allObjectP

Tests Stability Dependencies

StringRecord<string | number | symbol, T> => Promise<StringRecord<string | number | symbol, T>>

This takes an object where the values are probably promises and returns a promise that has that same object but with the resolved values.

Here's a good example of this function in use:

await allObjectP({
  merge: mergeResource(session),
  current: storeCurrent(session.id),
  account: pullAccount(session.relationship.account.data.id, client),
})
// {merge, current, account}

If we use allP or Promise.all we're getting an array back, but that's annoying to destructure. The allObjectP function gives us the concurrency we want with a named interface for the returned resolutions.

Readme

Keywords

Package Sidebar

Install

npm i @unction/allobjectp

Weekly Downloads

5

Version

13.15.0

License

SEE LICENSE IN LICENSE

Unpacked Size

18.6 kB

Total Files

7

Last publish

Collaborators

  • krainboltgreene