Skip to content

SirajChokshi/platform-ts

Repository files navigation

platform-ts

Size Minified License Version Downloads

A type-safe utility for user-agent sniffing. It uses ua-parser-js under the hood, but provides a richer API with discriminated unions providing type-safety for the most common, known results with escape hatches for less common user agents.

Installation

npm install platform-ts # or yarn or pnpm

Basic Usage

platform-ts

import { PlatformReader } from "platform-ts";

const reader = new PlatformReader();

reader.getBrowser().name; // "Chrome"
reader.getBrowser().version; // "87.0.4280.88"
reader.getEngine().name; // "Blink"

Documentation

platform-ts

https://platform-ts.siraj.page/docs

use-user-agent

https://platform-ts.siraj.page/use-user-agent

About

Type-safe user-agent sniffing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published