a-synchronous / a-synchronous/rubico
reduce.concurrent
- Lingua principale
- JavaScript
- Stelle
- 283
- Fork
- 17
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
```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
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- backend-api-design
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100