/caniuse-support

Query the caniuse offline database for feature support.

Primary LanguageTypeScriptMIT LicenseMIT

caniuse-support

Build Status Coverage Status Greenkeeper badge

Query the caniuse offline database for feature support.

Includes browser detection using bowser.

Usage

import { getSupport, detectBrowser, getVersionIndex } from "caniuse-support";

// Get feature support of specific browser.
getSupport("flexbox", { id: "chrome", version: "6.0" }); // { level: "partial", needPrefix: true, notes: [1] }

// Get feature support of specific browser using an user agent string.
const userAgent = "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0";
getSupport("transforms2d", detectBrowser(userAgent)); // { level: "full", needPrefix: false, notes: [] }

// Get matching caniuse version index.
getVersionIndex(detectBrowser(userAgent)); // "26"

For a list of queryable features see here.

Playground

Checkout this code pen.