npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ua-parser-lite

v1.0.1-alpha.1

Published

A lightweight, pure TypeScript utility to parse browser User-Agent strings and detect browser, OS, CPU, device, and engine information.

Readme

ua-parser-lite

A lightweight, pure TypeScript utility to parse browser User-Agent strings and detect browser, operating system, CPU, device, and engine information.


Features

  • Detect browser name and version
  • Detect operating system name and version
  • Detect CPU architecture
  • Detect device type (mobile, tablet, desktop, smart TV, console, wearable)
  • Detect rendering engine name and version
  • Works in Node.js and browser environments
  • Pure TypeScript, no external dependencies

Installation

pnpm add ua-parser-lite
# or
npm install ua-parser-lite
yarn add ua-parser-lite

Usage

Parse default User-Agent (browser environment)

import { parseUserAgent } from "ua-parser-lite";

const info = parseUserAgent();
console.log(info);

Parse a custom User-Agent string

const ua = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_1 like Mac OS X) Version/17.0 Mobile/15E148 Safari/604.1";
const info = parseUserAgent(ua);

console.log(info.browser.name);       // Safari
console.log(info.browser.version);    // 17.0
console.log(info.os.name);            // iOS (iPhone)
console.log(info.os.version);         // 17.1
console.log(info.device.type);        // mobile
console.log(info.cpu.architecture);   // undefined
console.log(info.engine.name);        // WebKit

API

parseUserAgent(userAgent?: string): UserAgentInfo

| Property | Type | Description | |----------|------|-------------| | userAgent | string | Original User-Agent string | | browser | { name: string; version: string } | Browser name and version | | os | { name: string; version: string } | Operating system name and version | | cpu | { architecture?: string } | CPU architecture (if detected) | | device | { type?: string } | Device type: mobile, tablet, desktop, smarttv, console, wearable, unknown | | engine | { name: string; version: string } | Rendering engine name and version |


Example Output

{
  userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 17_1 like Mac OS X)...",
  browser: { name: "Safari", version: "17.0" },
  os: { name: "iOS (iPhone)", version: "17.1" },
  cpu: { architecture: undefined },
  device: { type: "mobile" },
  engine: { name: "WebKit", version: "605.1.15" }
}

Testing

We use Jest for unit testing.

pnpm test           # Run all tests
pnpm test:coverage  # Run tests with coverage and open HTML report

Contributing

  1. Fork the repository
  2. Install dependencies: pnpm install
  3. Run tests: pnpm test
  4. Generate coverage report: pnpm test:coverage

License

MIT