codexparser 0.1.44 → 0.1.45
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.
- package/package.json +1 -1
- package/src/CodexParser.js +28 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "This is a Javascript Bible parser and text scanner. It will search through texts and collate all scripture references into an array and parse them into objects, and it will parse passages into objects by book, chapter, verse, and testament. ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
package/src/CodexParser.js
CHANGED
|
@@ -256,18 +256,44 @@ class CodexParser {
|
|
|
256
256
|
0,
|
|
257
257
|
this.chapterVerses[book][endChapter].indexOf(Number(endVerse)) + 1
|
|
258
258
|
)
|
|
259
|
-
|
|
260
259
|
// Construct ranges for the `to` object
|
|
261
260
|
parsedPassage.to = {
|
|
262
261
|
book: book,
|
|
263
262
|
chapter: Number(endChapter),
|
|
264
|
-
verses: [
|
|
263
|
+
verses: [endVerse],
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
parsedPassage.type = "multi_chapter_verse_range"
|
|
268
267
|
} else {
|
|
269
268
|
parsedPassage.verses.push(`${startVerse}-${endVerse}`)
|
|
270
269
|
}
|
|
270
|
+
} else {
|
|
271
|
+
if (separator !== ":") {
|
|
272
|
+
// then this is a chapter_range
|
|
273
|
+
let [startChapter, endChapter] = part.split("-")
|
|
274
|
+
parsedPassage.chapter = Number(startChapter)
|
|
275
|
+
parsedPassage.verses = [
|
|
276
|
+
`${this.chapterVerses[book][parsedPassage.chapter][0]}-${
|
|
277
|
+
this.chapterVerses[book][parsedPassage.chapter][
|
|
278
|
+
this.chapterVerses[book][parsedPassage.chapter].length - 1
|
|
279
|
+
]
|
|
280
|
+
}`,
|
|
281
|
+
]
|
|
282
|
+
parsedPassage.to = {
|
|
283
|
+
book: book,
|
|
284
|
+
chapter: Number(endChapter),
|
|
285
|
+
verses: [
|
|
286
|
+
`${this.chapterVerses[book][endChapter][0]}-${
|
|
287
|
+
this.chapterVerses[book][endChapter][
|
|
288
|
+
this.chapterVerses[book][endChapter].length - 1
|
|
289
|
+
]
|
|
290
|
+
}`,
|
|
291
|
+
],
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
// Handles when verses are present.
|
|
295
|
+
parsedPassage.verses = [part.split(separator)[1]]
|
|
296
|
+
}
|
|
271
297
|
}
|
|
272
298
|
} else {
|
|
273
299
|
// Handle individual chapter:verse references (e.g., "9:5" in "8:22-9:1,5")
|