codexparser 0.1.15 → 0.1.17
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 +23 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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
|
@@ -223,7 +223,7 @@ class CodexParser {
|
|
|
223
223
|
i++
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
|
|
227
227
|
return this // Return this instance for method chaining
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -471,6 +471,7 @@ class CodexParser {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
_isValid(passage, reference) {
|
|
474
|
+
const singleChapterBook = this.singleChapterBook.find((bible) => bible[passage.book])
|
|
474
475
|
if (!passage.verses) {
|
|
475
476
|
return {
|
|
476
477
|
error: true,
|
|
@@ -481,14 +482,27 @@ class CodexParser {
|
|
|
481
482
|
},
|
|
482
483
|
}
|
|
483
484
|
}
|
|
484
|
-
if (!
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
485
|
+
if (!singleChapterBook) {
|
|
486
|
+
if (!this.chapterVerses[passage.book][passage.chapter]) {
|
|
487
|
+
return {
|
|
488
|
+
error: true,
|
|
489
|
+
code: 102,
|
|
490
|
+
message: {
|
|
491
|
+
chapter_exists: false,
|
|
492
|
+
content: `Chapter ${passage.chapter} does not exist in ${passage.book}`,
|
|
493
|
+
},
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
if (!singleChapterBook[passage.book][passage.chapter]) {
|
|
498
|
+
return {
|
|
499
|
+
error: true,
|
|
500
|
+
code: 103,
|
|
501
|
+
message: {
|
|
502
|
+
chapter_exists: false,
|
|
503
|
+
content: `Chapter ${passage.chapter} does not exist in ${passage.book}`,
|
|
504
|
+
},
|
|
505
|
+
}
|
|
492
506
|
}
|
|
493
507
|
}
|
|
494
508
|
return true
|