async function runInSeriesOrParallel(values, promiseMapper, runInSeries) {
  if (runInSeries) {
    const results = [];
    for (const value of values) {
      const result = await promiseMapper(value);
      results.push(result);
    }
    return results;
  } else {
    const promises = values.map(promiseMapper);
    return await Promise.all(promises);
  }
}
@template T, U
@param {Array<T>} values
@param {(value: T) => Promise<U>} promiseMapper
@param {boolean} runInSeries
@return {Promise<Array<U>>}