UNPKG

webextensions-schema

Version:

Programmatically consume the WebExtensions Schema JSON files

27 lines (26 loc) 795 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const download_parse_1 = require("./download-parse"); class WebExtensionsSchema { constructor({ schemas, tag }) { this._schemas = schemas; this._tag = tag; } raw() { return this._schemas.raw; } namespaces() { return this._schemas.namespaces; } tag() { return this._tag; } } exports.WebExtensionsSchema = WebExtensionsSchema; const webExtensionsSchema = async (options = {}) => { const downloadParse = await new download_parse_1.DownloadParse(options).run(); const schemas = downloadParse.getSchemas(); const tag = downloadParse.getTag(); return new WebExtensionsSchema({ schemas, tag }); }; exports.default = webExtensionsSchema;