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 versionignoreMinor
(default:true
) - Ignore differences in patch browser versionsallowHigherVersions
(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 thecaniuse-lite
database hasn'nt yet been updated.