1.0.12 • Published 10 months ago

sanctus v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Quickstart setup

Install module:

npm i sanctus

Sample uses

import {SaintInfo, Sanctus} from "sanctus";

const sanctus = new Sanctus();

// Get a single saint for February 17, 2025
const saint: SaintInfo | undefined = sanctus.getSaint(new Date(2025, 1, 17));
console.log(saint?.name); // "San Teodoro de Bizancio"
// Get a saint using month (0-11) and day 
const saintByDate: SaintInfo | undefined = sanctus.getSaintFromMonthDay(2, 17);
console.log(saintByDate?.name); // "San Teodoro de Bizancio"
// Get all saints of the current day
const sanctus = new Sanctus();
const saintsOfDay: SaintInfo[] = sanctus.getSaintsOfDay();
console.log(saintsOfDay);
// Set a new date
sanctus.setDate(new Date(2025, 5, 1));
const saintsFromNewDate: SaintInfo[] = sanctus.getSaintsOfDay();
console.log(saintsFromNewDate);

Test

To run the test suite (with vitest), execute:

To run the app:

# linux and mac users:
make test
# for windows users:
npm run test

SanctusInterface Documentation

The SanctusInterface provides methods to retrieve information about saints based on dates or direct month/day lookups.

Interface Definition

export interface SanctusInterface {
    getSaint: (date?: Date) => SaintInfo | undefined;
    getSaintFromMonthDay: (month: number, day: number) => SaintInfo | undefined;
    getSaintsOfDay: (date?: Date) => SaintInfo[];
    getAllSaints: () => SaintInfo[];
    getCurrentDate: () => Date;
    setDate: (date: Date) => void;
}

Function Documentation

MethodDescriptionParametersReturn TypeExample Call
getSaintsingle saint info for the given date.date?: DateSaintInfo \| undefinedsanctus.getSaint(new Date(2025, 1, 17));
getSaintFromMonthDaysingle saint for month and day.month: number, day: numberSaintInfo \| undefinedsanctus.getSaintFromMonthDay(2, 17);
getSaintsOfDayall saints for the given date.date?: DateSaintInfo[]sanctus.getSaintsOfDay();
getAllSaintsall saints in the database.NoneSaintInfo[]sanctus.getAllSaints();
getCurrentDatecurrently set date in the instance.NoneDatesanctus.getCurrentDate();
setDateSets a new datedate: Datevoidsanctus.setDate(new Date(2025, 5, 1));

SaintInfo Type Definition

export type SaintInfo = {
    month: number;
    day: number;
    category: number;
    name: string;
    birth?: string;
    dead?: string;
    meaning?: string;
    shortDescription?: string;
    description?: string;
};

SaintInfo Properties

PropertyTypeRequiredDescription
monthnumber✅ YesMonth of the saint's feast day (1-12).
daynumber✅ YesDay of the saint's feast day (1-31).
categorynumber✅ YesCategory or rank of the saint: principal or not.
namestring✅ YesName of the saint.
birthstring❌ NoBirth year or approximate time.
deadstring❌ NoDeath year or approximate time.
meaningstring❌ NoMeaning or significance of the saint's name.
shortDescriptionstring❌ NoBrief summary of the saint.
descriptionstring❌ NoDetailed description of the saint's life.

1.0.12

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago