index.js
function browserslist (queries, opts) {
  if (typeof opts === 'undefined') opts = { }

  if (typeof opts.path === 'undefined') {
    opts.path = path.resolve ? path.resolve('.') : '.'
  }

  if (typeof queries === 'undefined' || queries === null) {
    var config = browserslist.loadConfig(opts)
    if (config) {
      queries = config
    } else {
      queries = browserslist.defaults
    }
  }

  if (!(typeof queries === 'string' || Array.isArray(queries))) {
    throw new BrowserslistError(
      'Browser queries must be an array or string. Got ' + typeof queries + '.')
  }

  var context = {
    ignoreUnknownVersions: opts.ignoreUnknownVersions,
    dangerousExtend: opts.dangerousExtend
  }

  env.oldDataWarning(browserslist.data)
  var stats = env.getStat(opts, browserslist.data)
  if (stats) {
    context.customUsage = { }
    for (var browser in stats) {
      fillUsage(context.customUsage, browser, stats[browser])
    }
  }

  var result = resolve(queries, context).sort(function (name1, name2) {
    name1 = name1.split(' ')
    name2 = name2.split(' ')
    if (name1[0] === name2[0]) {
      if (FLOAT_RANGE.test(name1[1]) && FLOAT_RANGE.test(name2[1])) {
        return parseFloat(name2[1]) - parseFloat(name1[1])
      } else {
        return compare(name2[1], name1[1])
      }
    } else {
      return compare(name1[0], name2[0])
    }
  })

  return uniq(result)
}
function browserslist (queries, opts) {
  if (typeof opts === 'undefined') opts = { }

  if (typeof opts.path === 'undefined') {
    opts.path = path.resolve ? path.resolve('.') : '.'
  }

  if (typeof queries === 'undefined' || queries === null) {
    var config = browserslist.loadConfig(opts)
    if (config) {
      queries = config
    } else {
      queries = browserslist.defaults
    }
  }

  if (!(typeof queries === 'string' || Array.isArray(queries))) {
    throw new BrowserslistError(
      'Browser queries must be an array or string. Got ' + typeof queries + '.')
  }

  var context = {
    ignoreUnknownVersions: opts.ignoreUnknownVersions,
    dangerousExtend: opts.dangerousExtend
  }

  env.oldDataWarning(browserslist.data)
  var stats = env.getStat(opts, browserslist.data)
  if (stats) {
    context.customUsage = { }
    for (var browser in stats) {
      fillUsage(context.customUsage, browser, stats[browser])
    }
  }

  var result = resolve(queries, context).sort(function (name1, name2) {
    name1 = name1.split(' ')
    name2 = name2.split(' ')
    if (name1[0] === name2[0]) {
      if (FLOAT_RANGE.test(name1[1]) && FLOAT_RANGE.test(name2[1])) {
        return parseFloat(name2[1]) - parseFloat(name1[1])
      } else {
        return compare(name2[1], name1[1])
      }
    } else {
      return compare(name1[0], name2[0])
    }
  })

  return uniq(result)
}
function browserslist ( queries , opts ) { if ( typeof opts === 'undefined' ) opts = { } if ( typeof opts . path === 'undefined' ) { opts . path = path . resolve ? path . resolve ( '.' ) : '.' } if ( typeof queries === 'undefined' || queries === null ) { var config = browserslist . loadConfig ( opts ) if ( config ) { queries = config } else { queries = browserslist . defaults } } if ( ! ( typeof queries === 'string' || Array . isArray ( queries ) ) ) { throw new BrowserslistError ( 'Browser queries must be an array or string. Got ' + typeof queries + '.' ) } var context = { ignoreUnknownVersions : opts . ignoreUnknownVersions , dangerousExtend : opts . dangerousExtend } env . oldDataWarning ( browserslist . data ) var stats = env . getStat ( opts , browserslist . data ) if ( stats ) { context . customUsage = { } for ( var browser in stats ) { fillUsage ( context . customUsage , browser , stats [ browser ] ) } } var result = resolve ( queries , context ) . sort ( function ( name1 , name2 ) { name1 = name1 . split ( ' ' ) name2 = name2 . split ( ' ' ) if ( name1 [ 0 ] === name2 [ 0 ] ) { if ( FLOAT_RANGE . test ( name1 [ 1 ] ) && FLOAT_RANGE . test ( name2 [ 1 ] ) ) { return parseFloat ( name2 [ 1 ] ) - parseFloat ( name1 [ 1 ] ) } else { return compare ( name2 [ 1 ] , name1 [ 1 ] ) } } else { return compare ( name1 [ 0 ] , name2 [ 0 ] ) } } ) return uniq ( result ) }
Return array of browsers by selection queries.

@param {(string|string[])} [queries=browserslist.defaults] Browser queries.
@param {object} [opts] Options.
@param {string} [opts.path="."] Path to processed file.
It will be used to find config files.
@param {string} [opts.env="production"] Processing environment.
It will be used to take right
queries from config file.
@param {string} [opts.config] Path to config file with queries.
@param {object} [opts.stats] Custom browser usage statistics
for "> 1% in my stats" query.
@param {boolean} [opts.ignoreUnknownVersions=false] Do not throw on unknown
version in direct query.
@param {boolean} [opts.dangerousExtend] Disable security checks
for extend query.
@returns {string[]} Array with browser names in Can I Use.

@example
browserslist('IE >= 10, IE 8') //=> ['ie 11', 'ie 10', 'ie 8']
Return array of browsers by selection queries .