UNPKG

feedsmith

Version:

Fast, all‑in‑one feed parser and generator for RSS, Atom, RDF, and JSON Feed, with support for Podcast, iTunes, Dublin Core, and OPML files.

15 lines (14 loc) 526 B
import { locales } from "../../../common/config.js"; import { parseJsonObject } from "../../../common/utils.js"; import { parseFeed } from "./utils.js"; import { detect } from "../detect/index.js"; //#region src/feeds/json/parse/index.ts const parse = (value, options) => { const json = parseJsonObject(value); if (!detect(json)) throw new Error(locales.invalidFeedFormat); const parsed = parseFeed(json, options); if (!parsed) throw new Error(locales.invalidFeedFormat); return parsed; }; //#endregion export { parse };