index.js
function doMatch (string, qs) {
  var or = /^(?:,\s*|\s+OR\s+)(.*)/i
  var and = /^\s+AND\s+(.*)/i

  return find(string, function (parsed, n, max) {
    if (and.test(parsed)) {
      qs.unshift({ type: QUERY_AND, queryString: parsed.match(and)[1] })
      return true
    } else if (or.test(parsed)) {
      qs.unshift({ type: QUERY_OR, queryString: parsed.match(or)[1] })
      return true
    } else if (n === max) {
      qs.unshift({ type: QUERY_OR, queryString: parsed.trim() })
      return true
    }
    return false
  })
}
function doMatch (string, qs) {
  var or = /^(?:,\s*|\s+OR\s+)(.*)/i
  var and = /^\s+AND\s+(.*)/i

  return find(string, function (parsed, n, max) {
    if (and.test(parsed)) {
      qs.unshift({ type: QUERY_AND, queryString: parsed.match(and)[1] })
      return true
    } else if (or.test(parsed)) {
      qs.unshift({ type: QUERY_OR, queryString: parsed.match(or)[1] })
      return true
    } else if (n === max) {
      qs.unshift({ type: QUERY_OR, queryString: parsed.trim() })
      return true
    }
    return false
  })
}
function doMatch ( string , qs ) { var or = / ^(?:,\s*|\s+OR\s+)(.*) / i var and = / ^\s+AND\s+(.*) / i return find ( string , function ( parsed , n , max ) { if ( and . test ( parsed ) ) { qs . unshift ( { type : QUERY_AND , queryString : parsed . match ( and ) [ 1 ] } ) return true } else if ( or . test ( parsed ) ) { qs . unshift ( { type : QUERY_OR , queryString : parsed . match ( or ) [ 1 ] } ) return true } else if ( n === max ) { qs . unshift ( { type : QUERY_OR , queryString : parsed . trim ( ) } ) return true } return false } ) }
Find query matches in a string. This function is meant to be called
repeatedly with the returned query string until there is no more matches.
@param {string} string A string with one or more queries.
@param {BrowserslistQuery[]} qs Out parameter,
will be filled with `BrowserslistQuery`.
@returns {string} The rest of the query string minus the matched part.
Find query matches in a string . This function is meant to be called repeatedly with the returned query string until there is no more matches .