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.
14 lines (13 loc) • 530 B
JavaScript
import { locales } from "../../../common/config.js";
import { detect } from "../detect/index.js";
import { normalizeNamespaces, parser } from "./config.js";
import { retrieveFeed } from "./utils.js";
//#region src/feeds/atom/parse/index.ts
const parse = (value, options) => {
if (!detect(value)) throw new Error(locales.invalidFeedFormat);
const parsed = retrieveFeed(normalizeNamespaces(parser.parse(value)), options);
if (!parsed) throw new Error(locales.invalidFeedFormat);
return parsed;
};
//#endregion
export { parse };