UNPKG

hindu-devotional-texts

Version:

Hand-curated, typed, authoritative Hindu devotional content — aartis, chalisas, kathas, stotras, mantras, ashtottaras & sahasranamas, Vedic suktas, daily prayers, puja vidhi, Navratri, tirthas, the festival/ekadashi calendar, and full scriptures (Bhagavad

39 lines (32 loc) • 1.55 kB
// Vaar Devata module barrel. Re-exports the module's types + data and defines // the lookup helpers (the dataset is small and date-indexed, so the helpers // live here rather than in the top-level barrel). import type { Deity } from '../types.js' import type { GrahaKey, VaarDevata } from './types.js' import { VAAR_DEVATA } from './vaar-devata.js' export type * from './types.js' export { VAAR_DEVATA, VAAR_SOURCES } from './vaar-devata.js' /** The day's Vaar Devata for a given date (`Date.getDay()`-indexed). */ export function getVaarDevataForDate(d: Date): VaarDevata { return VAAR_DEVATA[d.getDay()] } /** Look up by day slug ('sunday' … 'saturday'); `undefined` for an unknown key. */ export function getVaarDevataByKey(key: string | undefined): VaarDevata | undefined { return VAAR_DEVATA.find((v) => v.dayKey === key) } /** Look up by ruling graha — e.g. for a daśā-lord weekday remedy. */ export function getVaarDevataByGraha(graha: GrahaKey): VaarDevata | undefined { return VAAR_DEVATA.find((v) => v.grahaKey === graha) } /** The day's deities that have a roster slug, de-duplicated. */ export function vaarRosterIds(v: VaarDevata): Deity[] { const ids: Deity[] = [] for (const d of v.deities) { if (d.rosterId && !ids.includes(d.rosterId)) ids.push(d.rosterId) } return ids } /** The day's deity names joined for a one-line label ("Vishnu · Brihaspati · Sai Baba"). */ export function vaarDeityNames(v: VaarDevata, lang: 'en' | 'hi'): string { return v.deities.map((d) => d.name[lang]).join(' · ') }