# reduce

URL: https://caijiao.org/radash/async/reduce
Source: docs/radash/async/reduce.md
Description: 使用异步函数归约数组 一个处理返回Promise的回调函数的归约方法

使用异步函数归约数组




## 基本用法

一个处理返回Promise的回调函数的归约方法。

```ts
import { reduce } from 'radash'

const userIds = [1, 2, 3, 4]

const users = await reduce(userIds, async (acc, userId) => {
  const user = await api.users.find(userId)
  return {
    ...acc,
    [userId]: user
  }
}, {})
```
