@gracious.tech/bible-references
Version:
Bible reference detection, parsing, and rendering that supports any language.
48 lines (47 loc) • 2.3 kB
TypeScript
export interface PassageArgs {
book: string;
start_chapter?: number | undefined | null;
start_verse?: number | undefined | null;
end_chapter?: number | undefined | null;
end_verse?: number | undefined | null;
}
export type ReferenceType = 'book' | 'chapter' | 'verse' | 'range_verses' | 'range_chapters' | 'range_multi';
export type BookNamesArg = Record<string, string> | [string, string][];
export declare function _verses_str_to_obj(ref: string): {
start_chapter: number | undefined;
start_verse: number | undefined;
end_chapter: number | undefined;
end_verse: number | undefined;
};
export declare function _detect_book(input: string, book_names: [string, string][], exclude_book_names?: string[], match_from_start?: boolean): string | null;
export declare class PassageReference {
readonly type: ReferenceType;
readonly range: boolean;
readonly book: string;
readonly ot: boolean;
readonly nt: boolean;
readonly start_chapter: number;
readonly start_verse: number;
readonly end_chapter: number;
readonly end_verse: number;
readonly args_valid: boolean;
readonly _args: PassageArgs;
constructor(book: string, chapter?: number, verse?: number);
constructor(reference: PassageArgs);
static from_string(reference: string, book_names?: BookNamesArg, exclude_book_names?: string[], min_chars?: number, match_from_start?: boolean): PassageReference | null;
static from_refs(start: PassageReference, end: PassageReference): PassageReference;
static from_serialized(code: string): PassageReference;
get_book_string(book_names?: Record<string, string>): string;
get_verses_string(verse_sep?: string, range_sep?: string): string;
toString(book_names?: Record<string, string>, verse_sep?: string, range_sep?: string): string;
to_serialized(): string;
equals(ref: PassageReference): boolean;
is_before(chapter: number, verse: number): boolean;
is_after(chapter: number, verse: number): boolean;
includes(chapter: number, verse: number): boolean;
total_verses(): number;
get_start(): PassageReference;
get_end(): PassageReference;
get_prev_verse(prev_to_end?: boolean): PassageReference | null;
get_next_verse(after_end?: boolean): PassageReference | null;
}