JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53053
  • Score
    100M100P100Q155890F
  • License MIT

A utility to match a browselist query to browser user agents

Package Exports

  • browserslist-useragent

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (browserslist-useragent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Checks if the given user agent string satisfies a browserlist query.

Usage

const matchUA = require('browserlist-useragent')
matchUA(userAgentString, browslistQuery, options)

Example

const matchUA = require('browserlist-useragent')
const uaString = 'Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'

matchUA(uaString, ['Explorer >= 10'])
// returns true

Options

  • ignoreMinor (default: false) - Ignore differences in minor browser version
  • ignoreMinor (default: true) - Ignore differences in patch browser versions
  • allowHigherVersions (default: false) - Returns a match even if the browser version in user agent string is more than those specified in the browserlist query. This option can be helpful when targeting unreleased browsers or browsers for which the caniuse-lite database hasn'nt yet been updated.