"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = deleteCookies;

function deleteCookies(names) {
  const namesList = typeof names !== 'undefined' && !Array.isArray(names) ? [names] : names;

  if (typeof namesList === 'undefined') {
    return this.deleteAllCookies();
  }

  if (namesList.every(obj => typeof obj !== 'string')) {
    return Promise.reject(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies.html for documentation.'));
  }

  return Promise.all(namesList.map(name => this.deleteCookie(name)));
}