UNPKG

@nx/devkit

Version:

The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by

18 lines (17 loc) 590 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapAsyncIterable = mapAsyncIterable; async function* mapAsyncIterable(data, transform) { async function* f() { const generator = data[Symbol.asyncIterator] || data[Symbol.iterator]; const iterator = generator.call(data); let index = 0; let item = await iterator.next(); while (!item.done) { yield await transform(await item.value, index, data); index++; item = await iterator.next(); } } return yield* f(); }