"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sequentialAsyncForEach = sequentialAsyncForEach;
/**
 * Applies an asynchronous function for each element in an array.
 * Each application evaluation is done sequentially. That is, an asynchronous function
 * application of an element is evaluated only when the previous applications
 * have finished.
 *
 * @param array The array to be iterated over
 * @param func The asynchronous function to be applied to each element
 * @returns A Promise that resolves once every application has been evaluated
 */
function sequentialAsyncForEach(array, func) {
    return __awaiter(this, void 0, void 0, function* () {
        for (let i = 0; i < array.length; i += 1) {
            // eslint-disable-next-line no-await-in-loop
            yield func(array[i]);
        }
    });
}
//# sourceMappingURL=async.js.map