@rosetta/compat

0.2.1 • Public • Published

@rosetta/compat

Rosetta Project's browser compatibility package.

Note: This package is in the development phase. Expect most releases to contain breaking changes.

Install

Using npm:

npm install @rosetta/compat

Using yarn:

yarn add @rosetta/compat

Usage

import compat from "@rosetta/compat"

// Each of these will return a BrowserCompatibilityObject
compat.check("./main.css")
compat.check("./main.html")
compat.check("./main.abc", { type: "CSS" })
compat.checkCSS("body { background: red; }")
compat.checkHTML('<input type="button">Hello World!</input>')

API

compat.check(filename, options?)

Reads the contents of a file and runs either checkCSS or checkHTML depending on the file extension. If file extension cannot be determined, an options object can be passed in.

options {
  type: "CSS" | "HTML"
}

compat.checkCSS(input)

Parses the contents on input and returns a BrowserCompatibilityObject dictating the browser versions that can run the css.

compat.checkHTML(input)

Parses the contents on input and returns a BrowserCompatibilityObject dictating the browser versions that can run the html.

BrowserCompatibilityObject

BrowserCompatibilityObject {
  desktop: {
    chrome: VersionsObject,
    firefox: VersionsObject,
    ie: VersionsObject,
    edge: VersionsObject,
    safari: VersionsObject,
    opera: VersionsObject
  },
  mobile: {
    chrome: VersionsObject,
    firefox: VersionsObject,
    safari: VersionsObject,
    edge: VersionsObject,
    opera: VersionsObject
  }
}

VersionsObject {
  support: "SUPPORTED" | "PARTIAL SUPPORT" | "NONE" | "UNKNOWN",
  start: string | null,
  end: string | null
}

Package Sidebar

Install

npm i @rosetta/compat

Weekly Downloads

4

Version

0.2.1

License

MIT

Unpacked Size

15 kB

Total Files

11

Last publish

Collaborators

  • tiagof