codexparser 0.1.47 → 0.1.48
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 +9 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
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
|
@@ -302,7 +302,7 @@ class CodexParser {
|
|
|
302
302
|
? part.split(separator)
|
|
303
303
|
: [parsedPassage.chapter, part]
|
|
304
304
|
|
|
305
|
-
if (separator !== ":") {
|
|
305
|
+
if (separator.trim() !== ":" && !parsedPassage.chapter) {
|
|
306
306
|
if (singleChapterBook) {
|
|
307
307
|
parsedPassage.chapter = 1
|
|
308
308
|
parsedPassage.verses.push(versePart) // Add single verse to array
|
|
@@ -438,6 +438,7 @@ class CodexParser {
|
|
|
438
438
|
*/
|
|
439
439
|
populate(parsedPassage) {
|
|
440
440
|
const passages = []
|
|
441
|
+
|
|
441
442
|
const { book, chapter, verses, type, to } = parsedPassage
|
|
442
443
|
const version = parsedPassage.version ? parsedPassage.version.abbreviation : "eng"
|
|
443
444
|
this._setVersion(book, chapter, version) // Set version data if needed
|
|
@@ -451,11 +452,10 @@ class CodexParser {
|
|
|
451
452
|
}
|
|
452
453
|
} else if (type === "comma_separated_verses") {
|
|
453
454
|
// Handle explicitly mentioned verses (e.g., 3:1,3,6)
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
455
|
+
|
|
456
|
+
verses.forEach((verse) => {
|
|
457
|
+
passages.push({ book, chapter: Number(chapter), verse: Number(verse) })
|
|
458
|
+
})
|
|
459
459
|
} else if (type === "chapter_range") {
|
|
460
460
|
// Handle ranges of chapters (e.g., 3-5)
|
|
461
461
|
for (let currentChapter = chapter; currentChapter <= to.chapter; currentChapter++) {
|
|
@@ -726,7 +726,9 @@ class CodexParser {
|
|
|
726
726
|
cv: chapterString,
|
|
727
727
|
hash: `${combined.book.toLowerCase()}_${chapterString.replace(/:/g, ".").replace(/,/g, ".")}`,
|
|
728
728
|
}
|
|
729
|
-
|
|
729
|
+
if (combined.to === null) {
|
|
730
|
+
delete combined.to
|
|
731
|
+
}
|
|
730
732
|
return combined
|
|
731
733
|
}
|
|
732
734
|
|