How to use browserslist-useragent-regexp - 2 common examples

To help you get started, we’ve selected a few browserslist-useragent-regexp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pingcap / tidb-dashboard / ui / gulpfile.esm.js View on Github external
stream._transform = function (file, _filetype, callback) {
    const oriContents = file.contents.toString()
    const pattern = 'var __SUPPORTED_BROWSERS__ ='

    if (oriContents.indexOf(pattern) < 0) {
      return stream.emit('error', new Error(`Missing "${pattern}" pattern`))
    }
    const browserList = getUserAgentRegExp({ allowHigherVersions: true })
    const regPattern = new RegExp(`${pattern} .+`)
    const newContents = oriContents.replace(
      regPattern,
      `${pattern} ${browserList}`
    )
    file.contents = Buffer.from(newContents)
    callback(null, file)
  }
github KidkArolis / jetpack / lib / browsers.js View on Github external
function regexp (options) {
  return browserslistUseragentRegexp.getUserAgentRegExp({
    browsers: query(options),
    allowHigherVersions: true
  })
}

browserslist-useragent-regexp

A utility to compile browserslist query to a RegExp to test browser useragent.

MIT
Latest version published 9 months ago

Package Health Score

64 / 100
Full package analysis

Popular browserslist-useragent-regexp functions