a-synchronous / a-synchronous/rubico
reduce.concurrent
- Vorherrschende Sprache
- JavaScript
- Sterne
- 283
- Forks
- 17
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
```coffeescript
Reducer = (any, T)=>Promise|any
Foldable = Iterable|AsyncIterable|{ reduce: Reducer=>any }|Object
reduce.concurrent(
data Foldable,
reducer (any, any)=>Promise|any,
result any,
) -> Promise|any
reduce.concurrent(
reducer (any, any)=>Promise|any,
result any,
)(data Foldable) -> Promise|any
```
Concurrent `reduce`. Reduce operation happens by order of asynchronous resolution and then the order of data argument.
```javascript
reduce.concurrent(
[1, 2, 3],
async (total, number) => {
await Promise(resolve => setTimeout(resolve, number))
return total + number
},
0,
).then(console.log) // 6
```
Beitragsleitfaden
Rechercherichtung
Look at the existing reduce implementation in the codebase to understand the current structure. The new function needs to handle concurrent asynchronous operations while preserving order based on resolution and data argument. Start by examining how the library manages async iterables and reducers. Write tests to verify the concurrent behavior as described in the example.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100