Skip to content

Commit 69ef38e

Browse files
update types and deps
1 parent ba898f8 commit 69ef38e

File tree

3 files changed

+156
-187
lines changed

3 files changed

+156
-187
lines changed

dist/types/index.d.ts

Lines changed: 142 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,178 +1,144 @@
1-
declare module "utils/abbreviations" {
2-
const abbreviations: {
3-
[key: string]: string;
4-
};
5-
export default abbreviations;
1+
interface Word {
2+
word: string;
3+
index: number;
64
}
7-
declare module "utils/validation" {
8-
/**
9-
* Checks if the provided book name is a valid entry in the bibleData.
10-
*
11-
* @param bookName - The name of the book to check.
12-
* @return Indicates whether the book name is valid.
13-
*/
14-
function isValidBook(bookName: string): boolean;
15-
/**
16-
* Checks if the given chapter number is valid for the specified book.
17-
*
18-
* @param bookName - The name of the book.
19-
* @param chapterNumber - The number of the chapter.
20-
* @return Returns true if the chapter number is valid, false otherwise.
21-
*/
22-
function isValidChapter(bookName: string, chapterNumber: number): boolean;
23-
/**
24-
* Checks if the given verse number is valid for the specified book and chapter.
25-
*
26-
* @param bookName - The name of the book.
27-
* @param chapterNumber - The number of the chapter.
28-
* @param verseNumber - The number of the verse.
29-
* @return Returns true if the verse number is valid, false otherwise.
30-
*/
31-
function isValidVerse(bookName: string, chapterNumber: number, verseNumber: number): boolean;
32-
export { isValidBook, isValidChapter, isValidVerse };
33-
}
34-
declare module "index" {
35-
interface Word {
36-
word: string;
37-
index: number;
38-
}
39-
interface VerseResult {
40-
key: string;
41-
book: string;
42-
chapter: string;
43-
verse: string;
44-
content: string;
45-
}
46-
/**
47-
* Parses a verse string and returns either an array of word objects or a cleaned string.
48-
*
49-
* @param verse - The verse string to parse.
50-
* @param outputType - The type of output. Can be "default", "string", or "indexed".
51-
* @return The parsed verse based on the output type.
52-
* @deprecated The bible.json file no longer has translation markers, so this function is not needed.
53-
*/
54-
export function parseVerse(verse: string, outputType?: "default" | "string" | "indexed"): Array<Word> | string;
55-
/**
56-
* Retrieves a specific verse from the Bible data based on the provided book name, chapter number, and verse number.
57-
*
58-
* @param bookName - The name of the book containing the verse.
59-
* @param chapterNumber - The number of the chapter containing the verse.
60-
* @param verseNumber - The number of the verse to retrieve.
61-
* @param outputType - The type of output format desired (indexed or string).
62-
* @param cleanVerse - Whether to clean the verse before returning it.
63-
* @return The content of the requested verse based on the output type.
64-
*/
65-
export function getVerse(bookName: string, chapterNumber: number, verseNumber: number, outputType?: "default" | "indexed" | "string",
66-
/**
67-
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
68-
*/
69-
cleanVerse?: boolean): Array<VerseResult> | string | string[];
70-
/**
71-
* Retrieves information about a chapter from the Bible data.
72-
*
73-
* @param bookName - The name of the book containing the chapter.
74-
* @param chapterNumber - The number of the chapter to retrieve.
75-
* @param outputType - The type of output format desired (indexed or string).
76-
* @param cleanVerse - Whether to clean the verse before returning it.
77-
* @return The information about the chapter based on the output type.
78-
*/
79-
export function getChapter(bookName: string, chapterNumber: number, outputType?: "default" | "indexed" | "string",
80-
/**
81-
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
82-
*/
83-
cleanVerse?: boolean): Array<VerseResult> | string | string[];
84-
/**
85-
* Retrieves information about a book from the Bible data.
86-
*
87-
* @param bookName - The name of the book to retrieve.
88-
* @param outputType - The type of output format desired (indexed or string).
89-
* @param cleanVerse - Whether to clean the verse before returning it.
90-
* @return The information about the book based on the output type.
91-
*/
92-
export function getBook(bookName: string, outputType?: "default" | "indexed" | "string",
93-
/**
94-
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
95-
*/
96-
cleanVerse?: boolean): Array<VerseResult> | string | {
97-
[key: string]: string[];
98-
};
99-
/**
100-
* Retrieves the number of chapters in a specific book of the Bible.
101-
*
102-
* @param bookName - The name of the book.
103-
* @throws Throws an error if the book name is invalid.
104-
* @return The number of chapters in the specified book.
105-
*/
106-
export function getChapterCount(bookName: string): number;
107-
/**
108-
* Retrieves the number of verses in a specific chapter of a book in the Bible.
109-
*
110-
* @param bookName - The name of the book.
111-
* @param chapterNumber - The number of the chapter.
112-
* @throws Throws an error if the chapter reference is invalid.
113-
* @return The number of verses in the specified chapter.
114-
*/
115-
export function getVerseCount(bookName: string, chapterNumber: number): number;
116-
/**
117-
* Retrieves the list of Bible books.
118-
*
119-
* @return An array containing the names of all the Bible books.
120-
*/
121-
export function getBibleBooks(): string[];
122-
/**
123-
* Retrieves a range of verses from the Bible based on the provided start and end references.
124-
*
125-
* @param startBookName - The name of the starting book.
126-
* @param startChapterNumber - The number of the starting chapter.
127-
* @param startVerseNumber - The number of the starting verse.
128-
* @param endBookName - The name of the ending book.
129-
* @param endChapterNumber - The number of the ending chapter.
130-
* @param endVerseNumber - The number of the ending verse.
131-
* @param outputType - The type of output. Can be "indexed", "string", or "default".
132-
* @param cleanVerse - Whether to clean the verse before returning it.
133-
* @throws Throws an error if the verse reference is invalid.
134-
* @return Returns an array of verses or a string of verses depending on the outputType.
135-
*/
136-
export function getRange(startBookName: string, startChapterNumber: number, startVerseNumber: number, endBookName: string, endChapterNumber: number, endVerseNumber: number, outputType?: "default" | "indexed" | "string",
137-
/**
138-
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
139-
*/
140-
cleanVerse?: boolean): Array<VerseResult> | string | string[];
141-
/**
142-
* Searches for a query string in each verse of the Bible and returns the matching verses.
143-
*
144-
* @param query - The query string to search for.
145-
* @param caseSensitive - Whether the search should be case sensitive.
146-
* @param exactMatch - Whether the search should match the exact phrase.
147-
* @param outputType - The type of output format desired (indexed or string).
148-
* @return The matching verses based on the output type.
149-
*/
150-
export function searchVerse(query: string, caseSensitive?: boolean, exactMatch?: boolean, outputType?: "indexed" | "string"): Array<VerseResult> | string;
151-
/**
152-
* Resolves an abbreviation to its full name.
153-
*
154-
* @param abbreviation - The abbreviation to resolve.
155-
* @return The full name corresponding to the abbreviation.
156-
*/
157-
export function resolveAbbreviation(abbreviation: string): string;
158-
/**
159-
* Returns an object containing the number of books, chapters, and verses in the Bible.
160-
*
161-
* @return An object with the number of books, chapters, and verses in the Bible.
162-
*/
163-
export function bibleStats(): {
164-
books: number;
165-
chapters: number;
166-
verses: number;
167-
};
168-
/**
169-
* Returns an object containing the three validation functions: `isValidBook`, `isValidChapter`, and `isValidVerse`.
170-
*
171-
* @return An object with the validation functions as properties.
172-
*/
173-
export function bibleValidation(): {
174-
isValidBook: (bookName: string) => boolean;
175-
isValidChapter: (bookName: string, chapterNumber: number) => boolean;
176-
isValidVerse: (bookName: string, chapterNumber: number, verseNumber: number) => boolean;
177-
};
5+
interface VerseResult {
6+
key: string;
7+
book: string;
8+
chapter: string;
9+
verse: string;
10+
content: string;
17811
}
12+
/**
13+
* Parses a verse string and returns either an array of word objects or a cleaned string.
14+
*
15+
* @param verse - The verse string to parse.
16+
* @param outputType - The type of output. Can be "default", "string", or "indexed".
17+
* @return The parsed verse based on the output type.
18+
* @deprecated The bible.json file no longer has translation markers, so this function is not needed.
19+
*/
20+
export declare function parseVerse(verse: string, outputType?: "default" | "string" | "indexed"): Array<Word> | string;
21+
/**
22+
* Retrieves a specific verse from the Bible data based on the provided book name, chapter number, and verse number.
23+
*
24+
* @param bookName - The name of the book containing the verse.
25+
* @param chapterNumber - The number of the chapter containing the verse.
26+
* @param verseNumber - The number of the verse to retrieve.
27+
* @param outputType - The type of output format desired (indexed or string).
28+
* @param cleanVerse - Whether to clean the verse before returning it.
29+
* @return The content of the requested verse based on the output type.
30+
*/
31+
export declare function getVerse(bookName: string, chapterNumber: number, verseNumber: number, outputType?: "default" | "indexed" | "string",
32+
/**
33+
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
34+
*/
35+
cleanVerse?: boolean): Array<VerseResult> | string | string[];
36+
/**
37+
* Retrieves information about a chapter from the Bible data.
38+
*
39+
* @param bookName - The name of the book containing the chapter.
40+
* @param chapterNumber - The number of the chapter to retrieve.
41+
* @param outputType - The type of output format desired (indexed or string).
42+
* @param cleanVerse - Whether to clean the verse before returning it.
43+
* @return The information about the chapter based on the output type.
44+
*/
45+
export declare function getChapter(bookName: string, chapterNumber: number, outputType?: "default" | "indexed" | "string",
46+
/**
47+
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
48+
*/
49+
cleanVerse?: boolean): Array<VerseResult> | string | string[];
50+
/**
51+
* Retrieves information about a book from the Bible data.
52+
*
53+
* @param bookName - The name of the book to retrieve.
54+
* @param outputType - The type of output format desired (indexed or string).
55+
* @param cleanVerse - Whether to clean the verse before returning it.
56+
* @return The information about the book based on the output type.
57+
*/
58+
export declare function getBook(bookName: string, outputType?: "default" | "indexed" | "string",
59+
/**
60+
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
61+
*/
62+
cleanVerse?: boolean): Array<VerseResult> | string | {
63+
[key: string]: string[];
64+
};
65+
/**
66+
* Retrieves the number of chapters in a specific book of the Bible.
67+
*
68+
* @param bookName - The name of the book.
69+
* @throws Throws an error if the book name is invalid.
70+
* @return The number of chapters in the specified book.
71+
*/
72+
export declare function getChapterCount(bookName: string): number;
73+
/**
74+
* Retrieves the number of verses in a specific chapter of a book in the Bible.
75+
*
76+
* @param bookName - The name of the book.
77+
* @param chapterNumber - The number of the chapter.
78+
* @throws Throws an error if the chapter reference is invalid.
79+
* @return The number of verses in the specified chapter.
80+
*/
81+
export declare function getVerseCount(bookName: string, chapterNumber: number): number;
82+
/**
83+
* Retrieves the list of Bible books.
84+
*
85+
* @return An array containing the names of all the Bible books.
86+
*/
87+
export declare function getBibleBooks(): string[];
88+
/**
89+
* Retrieves a range of verses from the Bible based on the provided start and end references.
90+
*
91+
* @param startBookName - The name of the starting book.
92+
* @param startChapterNumber - The number of the starting chapter.
93+
* @param startVerseNumber - The number of the starting verse.
94+
* @param endBookName - The name of the ending book.
95+
* @param endChapterNumber - The number of the ending chapter.
96+
* @param endVerseNumber - The number of the ending verse.
97+
* @param outputType - The type of output. Can be "indexed", "string", or "default".
98+
* @param cleanVerse - Whether to clean the verse before returning it.
99+
* @throws Throws an error if the verse reference is invalid.
100+
* @return Returns an array of verses or a string of verses depending on the outputType.
101+
*/
102+
export declare function getRange(startBookName: string, startChapterNumber: number, startVerseNumber: number, endBookName: string, endChapterNumber: number, endVerseNumber: number, outputType?: "default" | "indexed" | "string",
103+
/**
104+
* @deprecated Use of `cleanVerse` will be removed in a future version. Verses are now always cleaned by default.
105+
*/
106+
cleanVerse?: boolean): Array<VerseResult> | string | string[];
107+
/**
108+
* Searches for a query string in each verse of the Bible and returns the matching verses.
109+
*
110+
* @param query - The query string to search for.
111+
* @param caseSensitive - Whether the search should be case sensitive.
112+
* @param exactMatch - Whether the search should match the exact phrase.
113+
* @param outputType - The type of output format desired (indexed or string).
114+
* @return The matching verses based on the output type.
115+
*/
116+
export declare function searchVerse(query: string, caseSensitive?: boolean, exactMatch?: boolean, outputType?: "indexed" | "string"): Array<VerseResult> | string;
117+
/**
118+
* Resolves an abbreviation to its full name.
119+
*
120+
* @param abbreviation - The abbreviation to resolve.
121+
* @return The full name corresponding to the abbreviation.
122+
*/
123+
export declare function resolveAbbreviation(abbreviation: string): string;
124+
/**
125+
* Returns an object containing the number of books, chapters, and verses in the Bible.
126+
*
127+
* @return An object with the number of books, chapters, and verses in the Bible.
128+
*/
129+
export declare function bibleStats(): {
130+
books: number;
131+
chapters: number;
132+
verses: number;
133+
};
134+
/**
135+
* Returns an object containing the three validation functions: `isValidBook`, `isValidChapter`, and `isValidVerse`.
136+
*
137+
* @return An object with the validation functions as properties.
138+
*/
139+
export declare function bibleValidation(): {
140+
isValidBook: (bookName: string) => boolean;
141+
isValidChapter: (bookName: string, chapterNumber: number) => boolean;
142+
isValidVerse: (bookName: string, chapterNumber: number, verseNumber: number) => boolean;
143+
};
144+
export {};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "best-bible",
3-
"version": "1.7.2",
3+
"version": "1.7.3",
44
"description": "Fetch, parse, and analyze the Bible easily with JavaScript",
55
"scripts": {
66
"prebuild": "rm -rf dist",
77
"build:cjs": "bun build src/index.ts --outdir dist/cjs --target node --format cjs --minify",
88
"build:esm": "bun build src/index.ts --outdir dist/esm --target node --format esm --minify",
9-
"build:types": "tsc --project tsconfig.types.json",
9+
"build:types": "tsc --project tsconfig.types.json && rm -rf dist/types/utils",
1010
"build:browser": "bun build src/browser.ts --outfile dist/browser/best-bible.min.js --target browser --minify",
1111
"build": "bun run prebuild && bun run build:cjs && bun run build:esm && bun run build:browser && bun run build:types",
1212
"prepublishOnly": "bun run build",
@@ -51,7 +51,7 @@
5151
"homepage": "https://github.com/The-Best-Codes/best-bible#readme",
5252
"devDependencies": {
5353
"@types/bun": "^1.1.14",
54-
"@types/node": "^22.10.3",
54+
"@types/node": "^22.10.5",
5555
"bun-types": "^1.1.42",
5656
"typescript": "^5.7.2"
5757
}

tsconfig.types.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{
22
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "esnext",
5+
"moduleResolution": "node",
36
"declaration": true,
47
"emitDeclarationOnly": true,
5-
"outFile": "./dist/types/index.d.ts",
6-
"moduleResolution": "node",
7-
"module": "amd",
8-
"allowJs": true,
8+
"outDir": "./dist/types",
99
"strict": true,
1010
"esModuleInterop": true,
1111
"skipLibCheck": true,
12+
"allowSyntheticDefaultImports": true,
1213
"forceConsistentCasingInFileNames": true,
14+
"resolveJsonModule": true,
1315
"baseUrl": ".",
14-
"rootDir": "./src",
15-
"resolveJsonModule": true
16+
"paths": {
17+
"*": ["./src/*"]
18+
}
1619
},
17-
"include": ["src/index.ts"],
18-
"exclude": ["dist", "node_modules", "src/browser.ts"]
20+
"include": ["src/**/*.ts"],
21+
"exclude": ["node_modules", "dist", "src/browser.ts"]
1922
}

0 commit comments

Comments
 (0)