New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browserslist-ua-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserslist-ua-parser

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

browserslist-ua-parser

Parse User-Agent into browserslist's compatible format

What is it?

This is User-Agent parser, but unlike others, it only returns browser name and version in browserslist's format. This helps you create Custom Usage Data.

Installation

with npm

npm install browserslist-ua-parser

with yarn

yarn add browserslist-ua-parser

with pnpm

pnpm add browserslist-ua-parser

Usage

import { parseUA } from 'browserslist-ua-parser'

parseUA('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36')
// { browser: 'chrome', version: '108' }

Notes

  • This library categorized the browsers based on their layout engine instead of their real browser's name, like all browsers on iOS will return ios_saf (Because all browsers in iOS use Webkit), or Browsers based on Chromium, such as MiuiBrowser will return chrome.

    This because this library intentionally used for detecting features using Browserslist, and that is how Browserslist work.

  • Chrome Android will be parsed as chrome instead of and_chr. This because Browserslist only work with last version on mobile browser (see this comment). This also applied to Firefox.

License

This project is licensed under the MIT License - see the LICENSE file for details

FAQs

Package last updated on 13 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc