awoken-bible-reference
Version:
Bible verse reference parser, generator and manipulator
41 lines (40 loc) • 1.75 kB
TypeScript
/**
* Pulls together all the modules into single coherent API of the library
*/
import { BibleRef, BibleVerse, BibleRefLibData } from './BibleRef';
import { Parsers, ParseResult } from './parser';
import { Versification } from './Versification';
import { FormatArg } from './printer';
import { ValidationError } from './validate';
import { RangeManipFunctions } from './range-manip';
import { GeometryFunctions } from './geometry';
/**
* Publically exposed interface to this library
*/
export interface BibleRefLib extends BibleRefLibData, RangeManipFunctions, GeometryFunctions {
parse(str: string): ParseResult;
parseOrThrow(str: string): BibleRef[];
parseUrlEncoded(this: BibleRefLib, str: string): BibleRef[];
parseBookName(this: BibleRefLib, str: string): string | null;
format(b: BibleRef | BibleRef[], opts?: FormatArg): string;
sort(refs: BibleRef[]): BibleRef[];
toVidx(verse: BibleVerse): number;
fromVidx(vidx: number): BibleVerse;
firstNVerses(refs: BibleRef | BibleRef[], n: number): BibleRef[];
countVerses(refs: BibleRef | BibleRef[]): number;
validate(refs: BibleRef | BibleRef[], include_warnings?: boolean): ValidationError[];
repair(ref: BibleRef, include_warnings?: boolean): BibleRef;
_parsers: Parsers;
}
/**
* Constructor interface
*
* We are using a hybrid interface to this lib, you can just require(lib)
* and call function such as parse, parseOrThrow, etc - or you can construct a
* new instance with a non standard versification scheme and then call methods
* of that
*/
declare type BibleRefLibConstructor = (v: Versification) => BibleRefLib;
declare const AwokenRef: BibleRefLib & BibleRefLibConstructor;
export default AwokenRef;
export { AwokenRef };