function parseOptions (input) {
  var output = {}
  var hasValidOptions = false

  input.split(',').forEach(function (option) {
    if (option.startsWith('domain=')) {
      var domainString = option.split('=')[1].trim()
      parseDomains(domainString, output)
      hasValidOptions = true
    } else {
      /*
      Element types are stored as an int, where each bit is a type (see elementTypesSet)
      1 -> the filter should match for this element type
      If the filter defines a type to skip, then all other types should implicitly match
      If it defines types to match, all other types should implicitly not match
      */

      // the option is an element type to skip
      if (option[0] === '~' && elementTypes.indexOf(option.substring(1)) !== -1) {
        if (output.elementTypes === undefined) {
          output.elementTypes = defaultElementTypes
        }
        output.elementTypes = output.elementTypes & (~elementTypesSet[option.substring(1)])
        hasValidOptions = true

      // the option is an element type to match
      } else if (elementTypes.indexOf(option) !== -1) {
        output.elementTypes = (output.elementTypes || 0) | elementTypesSet[option]
        hasValidOptions = true
      }

      if (option === 'third-party') {
        output.thirdParty = true
        hasValidOptions = true
      }

      if (option === '~third-party') {
        output.notThirdParty = true
        hasValidOptions = true
      }
    }
  })

  if (hasValidOptions) {
    return output
  } else {
    return null
  }
}
Parses options from the passed in input string