@joewalker/scripture-ref 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Verse is a pointer to a short section of a book. It is designed to be
3
+ * agnostic to the contents of the book however, we're starting with the
4
+ * standard western Christian canon. The API to Verse should not expose this,
5
+ * however.
6
+ */
7
+ export declare class Verse {
8
+ #private;
9
+ /**
10
+ * Construct a verse from numeric coordinates.
11
+ *
12
+ * Finite integer values below the valid range clamp to the first valid
13
+ * coordinate, and values above the valid range clamp to the last valid
14
+ * coordinate.
15
+ */
16
+ constructor(book: number, chapter: number, verse: number);
17
+ get book(): number;
18
+ get chapter(): number;
19
+ get verse(): number;
20
+ /**
21
+ * Create a JSON serializable version of this verse
22
+ */
23
+ toJson(): {
24
+ book: number;
25
+ chapter: number;
26
+ verse: number;
27
+ };
28
+ /**
29
+ * What is the canonical representation of this verse?
30
+ */
31
+ toString(basis?: Verse): string;
32
+ /**
33
+ * Construct a new Verse from a text specification
34
+ */
35
+ static fromString(spec: string): Verse;
36
+ /**
37
+ * Construct a new Verse from an ordinal
38
+ */
39
+ static fromOrdinal(ordinal: number): Verse;
40
+ /**
41
+ * Which of the given verses is the earlier in the Bible
42
+ */
43
+ static min(first: Verse, ...rest: ReadonlyArray<Verse>): Verse;
44
+ /**
45
+ * Which of the given verses is the latter in the Bible
46
+ */
47
+ static max(first: Verse, ...rest: ReadonlyArray<Verse>): Verse;
48
+ /**
49
+ * Is this verse at the end of a chapter?
50
+ */
51
+ isAtStartOfChapter(): boolean;
52
+ /**
53
+ * Is this verse at the end of a chapter?
54
+ */
55
+ isAtEndOfChapter(): boolean;
56
+ /**
57
+ * Returns the verse at the end of the current chapter
58
+ */
59
+ atEndOfChapter(): Verse;
60
+ /**
61
+ * Is this verse at the end of a book?
62
+ */
63
+ isAtStartOfBook(): boolean;
64
+ /**
65
+ * Is this verse at the end of a book?
66
+ */
67
+ isAtEndOfBook(): boolean;
68
+ /**
69
+ * Returns the verse at the end of the current book
70
+ */
71
+ atEndOfBook(): Verse;
72
+ /**
73
+ * Compare 2 verses, for use in sorting verse arrays
74
+ */
75
+ static comparator(v1: Verse, v2: Verse): number;
76
+ /**
77
+ * If the Bible didn't have books or chapters what verse would this be?
78
+ * Gen 1:1 has an ordinal of 1.
79
+ */
80
+ get ordinal(): number;
81
+ }
82
+ /**
83
+ * How accurately was a verse specified. e.g. 'gen' is just to the book level
84
+ * (and we might assume chapter 1, verse 1) but 'gen 1 1' definitively says
85
+ * which verse we want
86
+ */
87
+ export declare const ACCURACY: Readonly<{
88
+ verse: "verse";
89
+ chapter: "chapter";
90
+ book: "book";
91
+ }>;
92
+ export type Accuracy = (typeof ACCURACY)[keyof typeof ACCURACY];
93
+ /**
94
+ * Return value for {@link _parseVerse()}
95
+ * @see _parseVerse()
96
+ */
97
+ export interface VerseParseResult {
98
+ readonly verse: Verse;
99
+ readonly accuracy: Accuracy;
100
+ }
101
+ /**
102
+ * This is an internal function.
103
+ */
104
+ export declare function _parseVerse(spec: string, basis?: VerseParseResult): VerseParseResult;
@@ -0,0 +1,295 @@
1
+ import { booksInBible, chaptersInBook, decodeOrdinal, findBookNumber, getShortName, verseOrdinal, versesInChapter, } from './bible-info.js';
2
+ const PART_SEPARATORS = /:|\s|\./;
3
+ /**
4
+ * Verse is a pointer to a short section of a book. It is designed to be
5
+ * agnostic to the contents of the book however, we're starting with the
6
+ * standard western Christian canon. The API to Verse should not expose this,
7
+ * however.
8
+ */
9
+ export class Verse {
10
+ #book;
11
+ #chapter;
12
+ #verse;
13
+ /**
14
+ * Construct a verse from numeric coordinates.
15
+ *
16
+ * Finite integer values below the valid range clamp to the first valid
17
+ * coordinate, and values above the valid range clamp to the last valid
18
+ * coordinate.
19
+ */
20
+ constructor(book, chapter, verse) {
21
+ assertFiniteInteger(book, 'book');
22
+ assertFiniteInteger(chapter, 'chapter');
23
+ assertFiniteInteger(verse, 'verse');
24
+ const maxBook = booksInBible();
25
+ this.#book = Math.min(Math.max(book, 1), maxBook);
26
+ const maxChapter = chaptersInBook(this.#book);
27
+ this.#chapter = Math.min(Math.max(chapter, 1), maxChapter);
28
+ const maxVerse = versesInChapter(this.#book, this.#chapter);
29
+ this.#verse = Math.min(Math.max(verse, 1), maxVerse);
30
+ }
31
+ get book() {
32
+ return this.#book;
33
+ }
34
+ get chapter() {
35
+ return this.#chapter;
36
+ }
37
+ get verse() {
38
+ return this.#verse;
39
+ }
40
+ /**
41
+ * Create a JSON serializable version of this verse
42
+ */
43
+ toJson() {
44
+ return {
45
+ book: this.#book,
46
+ chapter: this.#chapter,
47
+ verse: this.#verse,
48
+ };
49
+ }
50
+ /**
51
+ * What is the canonical representation of this verse?
52
+ */
53
+ toString(basis) {
54
+ if (basis == null) {
55
+ // Special case for single chapter books (like Jude, Philemon, etc.)
56
+ if (chaptersInBook(this.#book) === 1) {
57
+ return `${getShortName(this.#book)} ${this.#verse}`;
58
+ }
59
+ return `${getShortName(this.#book)} ${this.#chapter}:${this.#verse}`;
60
+ }
61
+ // Special case for single chapter books (like Jude, Philemon, etc.)
62
+ if (chaptersInBook(this.#book) === 1) {
63
+ return basis != null && basis.#book === this.#book
64
+ ? `${this.#verse}`
65
+ : `${getShortName(this.#book)} ${this.#verse}`;
66
+ }
67
+ if (basis.book !== this.book) {
68
+ return `${getShortName(this.#book)} ${this.#chapter}:${this.#verse}`;
69
+ }
70
+ if (basis.chapter !== this.chapter) {
71
+ return `${this.#chapter}:${this.#verse}`;
72
+ }
73
+ return `${this.#verse}`;
74
+ }
75
+ /**
76
+ * Construct a new Verse from a text specification
77
+ */
78
+ static fromString(spec) {
79
+ return _parseVerse(spec).verse;
80
+ }
81
+ /**
82
+ * Construct a new Verse from an ordinal
83
+ */
84
+ static fromOrdinal(ordinal) {
85
+ const [book, chapter, verse] = decodeOrdinal(ordinal);
86
+ return new Verse(book, chapter, verse);
87
+ }
88
+ /**
89
+ * Which of the given verses is the earlier in the Bible
90
+ */
91
+ static min(first, ...rest) {
92
+ return rest.reduce((minSoFar, current) => {
93
+ return Verse.comparator(minSoFar, current) > 0 ? current : minSoFar;
94
+ }, first);
95
+ // The following might be faster:
96
+ // return new Verse(...decodeOrdinal(Math.min(...vs.map(v => v.ordinal))));
97
+ // However, our algorithm has the benefit of preserving identity.
98
+ // i.e. we can do `===` on the return from this function, and it will be the
99
+ // same object as one of the inputs
100
+ }
101
+ /**
102
+ * Which of the given verses is the latter in the Bible
103
+ */
104
+ static max(first, ...rest) {
105
+ return rest.reduce((maxSoFar, current) => {
106
+ return Verse.comparator(maxSoFar, current) < 0 ? current : maxSoFar;
107
+ }, first);
108
+ // See notes in Verse.min
109
+ }
110
+ /**
111
+ * Is this verse at the end of a chapter?
112
+ */
113
+ isAtStartOfChapter() {
114
+ return this.#verse === 1;
115
+ }
116
+ /**
117
+ * Is this verse at the end of a chapter?
118
+ */
119
+ isAtEndOfChapter() {
120
+ return this.#verse === versesInChapter(this.#book, this.#chapter);
121
+ }
122
+ /**
123
+ * Returns the verse at the end of the current chapter
124
+ */
125
+ atEndOfChapter() {
126
+ const maxVerse = versesInChapter(this.#book, this.#chapter);
127
+ return new Verse(this.#book, this.#chapter, maxVerse);
128
+ }
129
+ /**
130
+ * Is this verse at the end of a book?
131
+ */
132
+ isAtStartOfBook() {
133
+ return this.#chapter === 1 && this.#verse === 1;
134
+ }
135
+ /**
136
+ * Is this verse at the end of a book?
137
+ */
138
+ isAtEndOfBook() {
139
+ return (this.#chapter === chaptersInBook(this.#book) &&
140
+ this.#verse === versesInChapter(this.#book, this.#chapter));
141
+ }
142
+ /**
143
+ * Returns the verse at the end of the current book
144
+ */
145
+ atEndOfBook() {
146
+ const maxChapter = chaptersInBook(this.#book);
147
+ const maxVerse = versesInChapter(this.#book, maxChapter);
148
+ return new Verse(this.#book, maxChapter, maxVerse);
149
+ }
150
+ /**
151
+ * Compare 2 verses, for use in sorting verse arrays
152
+ */
153
+ static comparator(v1, v2) {
154
+ if (v1.book < v2.book) {
155
+ return -1;
156
+ }
157
+ if (v1.book > v2.book) {
158
+ return 1;
159
+ }
160
+ if (v1.chapter < v2.chapter) {
161
+ return -1;
162
+ }
163
+ if (v1.chapter > v2.chapter) {
164
+ return 1;
165
+ }
166
+ if (v1.verse < v2.verse) {
167
+ return -1;
168
+ }
169
+ if (v1.verse > v2.verse) {
170
+ return 1;
171
+ }
172
+ return 0;
173
+ }
174
+ /**
175
+ * If the Bible didn't have books or chapters what verse would this be?
176
+ * Gen 1:1 has an ordinal of 1.
177
+ */
178
+ get ordinal() {
179
+ return verseOrdinal(this.book, this.chapter, this.verse);
180
+ }
181
+ }
182
+ /**
183
+ * Validate that a numeric verse coordinate can be clamped predictably.
184
+ */
185
+ function assertFiniteInteger(value, coordinate) {
186
+ if (!Number.isFinite(value) || !Number.isInteger(value)) {
187
+ throw new Error(`Illegal ${coordinate} number (${value}). Must be a finite integer.`);
188
+ }
189
+ }
190
+ /**
191
+ * parseInt without the silliness
192
+ */
193
+ function asInt(value) {
194
+ /* istanbul ignore else */
195
+ if (/^(\d+)$/.test(value)) {
196
+ return Number(value);
197
+ }
198
+ else {
199
+ throw new Error(`Can't understand '${value}' as a number`);
200
+ }
201
+ }
202
+ /**
203
+ * How accurately was a verse specified. e.g. 'gen' is just to the book level
204
+ * (and we might assume chapter 1, verse 1) but 'gen 1 1' definitively says
205
+ * which verse we want
206
+ */
207
+ export const ACCURACY = Object.freeze({
208
+ verse: 'verse',
209
+ chapter: 'chapter',
210
+ book: 'book',
211
+ });
212
+ /**
213
+ * This is an internal function.
214
+ */
215
+ export function _parseVerse(spec, basis) {
216
+ const parts = spec
217
+ .replace(/^I /i, '1 ')
218
+ .replace(/^II /i, '2 ')
219
+ .replace(/^III /i, '3 ')
220
+ .replace(/^([1-3]+)[ .]+([A-Za-z])/, '$1$2')
221
+ .split(PART_SEPARATORS)
222
+ .filter(part => part.trim().length !== 0);
223
+ if (parts.length > 3) {
224
+ // e.g. 'gen 1 1 1'
225
+ throw new Error(`Too many parts '${parts.join(' | ')}'`);
226
+ }
227
+ const book = findBookNumber(parts[0]);
228
+ if (parts.length === 3) {
229
+ if (book !== undefined) {
230
+ // e.g. 'gen 1 1'
231
+ return {
232
+ verse: new Verse(book, asInt(parts[1]), asInt(parts[2])),
233
+ accuracy: ACCURACY.verse,
234
+ };
235
+ }
236
+ // e.g. 'qqq 1 1'
237
+ throw new Error(`Can't understand '${parts[0]}' as a book`);
238
+ }
239
+ if (parts.length === 2) {
240
+ // e.g. 'gen 1'
241
+ if (book !== undefined) {
242
+ if (chaptersInBook(book) === 1) {
243
+ return {
244
+ verse: new Verse(book, 1, asInt(parts[1])),
245
+ accuracy: ACCURACY.verse,
246
+ };
247
+ }
248
+ return {
249
+ verse: new Verse(book, asInt(parts[1]), 1),
250
+ accuracy: ACCURACY.chapter,
251
+ };
252
+ }
253
+ if (basis === undefined) {
254
+ // e.g. 'qqq 1'
255
+ throw new Error(`Can't understand '${parts[0]}' as a book and there is no basis`);
256
+ }
257
+ // e.g. '1 1'
258
+ return {
259
+ verse: new Verse(basis.verse.book, asInt(parts[0]), asInt(parts[1])),
260
+ accuracy: ACCURACY.verse,
261
+ };
262
+ }
263
+ // So (parts.length === 1)
264
+ if (book !== undefined) {
265
+ // e.g. 'gen'
266
+ return {
267
+ verse: new Verse(book, 1, 1),
268
+ accuracy: ACCURACY.book,
269
+ };
270
+ }
271
+ if (basis === undefined) {
272
+ throw new Error(`Can't understand '${parts[0]}' as a book and there is no basis.`);
273
+ }
274
+ switch (basis.accuracy) {
275
+ case ACCURACY.book: {
276
+ // We have a basis so this is like 'gen - 1'
277
+ throw new Error(`Can't understand '${parts[0]}' as a book.`);
278
+ }
279
+ case ACCURACY.chapter: {
280
+ // e.g. 'gen 1-2'
281
+ return {
282
+ verse: new Verse(basis.verse.book, asInt(parts[0]), 1),
283
+ accuracy: ACCURACY.chapter,
284
+ };
285
+ }
286
+ case ACCURACY.verse: {
287
+ // e.g. 'gen 1:1-2'
288
+ return {
289
+ verse: new Verse(basis.verse.book, basis.verse.chapter, asInt(parts[0])),
290
+ accuracy: ACCURACY.verse,
291
+ };
292
+ }
293
+ }
294
+ }
295
+ //# sourceMappingURL=verse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verse.js","sourceRoot":"","sources":["../../src/passage/verse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC;;;;;GAKG;AACH,MAAM,OAAO,KAAK;IACP,KAAK,CAAS;IACd,QAAQ,CAAS;IACjB,MAAM,CAAS;IAExB;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,OAAe,EAAE,KAAa;QACtD,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACxC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAEpC,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAElD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAE3D,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CA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Q,EAAE,QAAQ,CAAC,IAAI;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,CAAC,CAAC,CAAC,oCAAoC,CAClE,CAAC;IACJ,CAAC;IAED,QAAQ,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACnB,4CAA4C;YAC5C,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC/D,CAAC;QAED,KAAK,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,iBAAiB;YACjB,OAAO;gBACL,KAAK,EAAE,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACtD,QAAQ,EAAE,QAAQ,CAAC,OAAO;aAC3B,CAAC;QACJ,CAAC;QAED,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACpB,mBAAmB;YACnB,OAAO;gBACL,KAAK,EAAE,IAAI,KAAK,CACd,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,KAAK,CAAC,KAAK,CAAC,OAAO,EACnB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAChB;gBACD,QAAQ,EAAE,QAAQ,CAAC,KAAK;aACzB,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@joewalker/scripture-ref",
3
+ "version": "0.4.0",
4
+ "description": "Manage references to Biblical passages",
5
+ "author": "Joe Walker <joe@eireneh.com>",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://gitlab.com/joewalk/scripture-ref.git"
11
+ },
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "types": "./dist/index.d.ts"
18
+ },
19
+ "./__testutil__": {
20
+ "import": "./dist/__testutil__/index.js",
21
+ "types": "./dist/__testutil__/index.d.ts"
22
+ }
23
+ },
24
+ "files": [
25
+ "CHANGELOG.md",
26
+ "dist",
27
+ "LICENSE",
28
+ "README.md"
29
+ ],
30
+ "devDependencies": {
31
+ "@eslint/js": "9.39.2",
32
+ "@types/node": "25.6.0",
33
+ "@vitest/coverage-v8": "4.1.5",
34
+ "eslint-plugin-import": "2.32.0",
35
+ "eslint-plugin-n": "17.24.0",
36
+ "eslint": "9.39.2",
37
+ "globals": "17.5.0",
38
+ "oxfmt": "0.46.0",
39
+ "typescript-eslint": "8.59.0",
40
+ "typescript": "6.0.3",
41
+ "vitest": "4.1.5"
42
+ },
43
+ "license": "Apache-2.0",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "scripts": {
48
+ "build": "rm -rf dist cache/tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
49
+ "clean": "rm -rf dist cache/tsconfig.build.tsbuildinfo",
50
+ "format": "oxfmt",
51
+ "lint": "eslint .",
52
+ "test:watch": "vitest",
53
+ "test": "vitest run",
54
+ "tsc": "tsc -p ."
55
+ }
56
+ }