code: async function forEachAsync(array, callback, option = {}) {
    const {
      extractValue = true,
      unify: unifyResults = true,
      expandArrayResults = true,
    } = option;
    const inputArray = Array.isArray(array) ? array : [array];
    const values = [];
    for (let index = 0; index < inputArray.length; index++) {
      let res;
      try {
        res = await callback(inputArray[index], index, inputArray);
        if (Array.isArray(res) && expandArrayResults) {
          res.forEach(val => values.push(val));
        } else if (res) {
          values.push(res);
        }
      } catch (err) {
        throw err;
      }
    }
    if (unifyResults) {
      return unify(values, { extractValue: true });
    }
    return values;
  }
docs: Mimic Array.forEach() API, but with an async callback function. Execute each callback on each array item serially. Useful when using WebDriverIO API.  Added due because of problem with chrome driver when too many requests are made simultaneously. https://bugs.chromium.org/p/chromedriver/issues/detail?id=2152#c9  @param {object[]} array Input array items to iterate over @param {function} callback Async function to excute on each array item @param {object} option Additional options. 'extractValue' will extract the .value object from a WebdriverIO