UNPKG

rsshub

Version:
22 lines (21 loc) 741 B
import "./config-Bpyy15zS.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import title from "title"; //#region lib/utils/common-utils.ts const toTitleCase = (str) => title(str); const rWhitespace = /\s+/; const rAllWhitespace = /\s+/g; const collapseWhitespace = (str) => { if (str && rWhitespace.test(str)) return str.replaceAll(rAllWhitespace, " ").trim(); return str; }; const convertDateToISO8601 = (date) => { if (!date) return date; if (!(date instanceof Date)) date = parseDate(date); return date.toISOString(); }; const getSubPath = (ctx) => { return ctx.req.path.replace(/\/[^/]*/, "") || "/"; }; //#endregion export { toTitleCase as i, convertDateToISO8601 as n, getSubPath as r, collapseWhitespace as t };