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.
npm install platform-ts # or yarn or pnpm
import { PlatformReader } from "platform-ts";
const reader = new PlatformReader();
reader.getBrowser().name; // "Chrome"
reader.getBrowser().version; // "87.0.4280.88"
reader.getEngine().name; // "Blink"