mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-02-04 10:54:44 -05:00
switched to NKJV, improved grading, improved styling
This commit is contained in:
@@ -1,10 +1,26 @@
|
||||
import type { BibleBook, Testament, BibleSection } from '$lib/types/bible';
|
||||
import { bibleBooks } from '$lib/types/bible';
|
||||
|
||||
// Book number (1-66) to book ID mapping derived from bibleBooks order property
|
||||
export const bookNumberToId: Record<number, string> = bibleBooks.reduce((acc, book) => {
|
||||
acc[book.order] = book.id;
|
||||
return acc;
|
||||
}, {} as Record<number, string>);
|
||||
|
||||
// Book ID to book number mapping (reverse lookup)
|
||||
export const bookIdToNumber: Record<string, number> = bibleBooks.reduce((acc, book) => {
|
||||
acc[book.id] = book.order;
|
||||
return acc;
|
||||
}, {} as Record<string, number>);
|
||||
|
||||
export function getBookById(id: string): BibleBook | undefined {
|
||||
return bibleBooks.find((book) => book.id === id);
|
||||
}
|
||||
|
||||
export function getBookByNumber(number: number): BibleBook | undefined {
|
||||
return bibleBooks.find((book) => book.order === number);
|
||||
}
|
||||
|
||||
export function getBooksByTestament(testament: Testament): BibleBook[] {
|
||||
return bibleBooks.filter((book) => book.testament === testament);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user