|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
370 bytes
|
| Line | |
|---|
| 1 | import { flatten } from './flatten.mjs';
|
|---|
| 2 | import { limitAsync } from './limitAsync.mjs';
|
|---|
| 3 |
|
|---|
| 4 | async function flatMapAsync(array, callback, options) {
|
|---|
| 5 | if (options?.concurrency != null) {
|
|---|
| 6 | callback = limitAsync(callback, options.concurrency);
|
|---|
| 7 | }
|
|---|
| 8 | const results = await Promise.all(array.map(callback));
|
|---|
| 9 | return flatten(results);
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | export { flatMapAsync };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.