1.0.0 • Published 1 year ago

p-map-values v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

p-map-values

A function similar to lodash.mapValues or Ramda.mapObjIndexed, but for async functions

Installation

pnpm add p-map-values

Usage

import pMapValues from 'p-map-values'

const users = {
  fred: { id: 1 },
  pebbles: { id: 2 },
}

pMapValues(async (user) => await fetchUserFromDB(user.id), users)
// => { fred: { age: 40 }, pebbles: { age: 1 } }

License

MIT © Zoltan Kochan