codexparser 0.1.28 → 0.1.29
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 +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
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
|
@@ -542,10 +542,12 @@ class CodexParser {
|
|
|
542
542
|
* @return {object} The combined passage object.
|
|
543
543
|
*/
|
|
544
544
|
combine(passages) {
|
|
545
|
-
|
|
545
|
+
// Only check if passages are from the same book
|
|
546
|
+
const noDuplicates = [...new Set(passages.map((p) => p.book))]
|
|
546
547
|
if (noDuplicates.length > 1) {
|
|
547
|
-
throw new Error("Passages are not from the same book
|
|
548
|
+
throw new Error("Passages are not from the same book.")
|
|
548
549
|
}
|
|
550
|
+
|
|
549
551
|
const newPassages = []
|
|
550
552
|
passages.forEach((passageSet) => {
|
|
551
553
|
passageSet.passages.forEach((passage) => {
|
|
@@ -556,6 +558,7 @@ class CodexParser {
|
|
|
556
558
|
}
|
|
557
559
|
})
|
|
558
560
|
})
|
|
561
|
+
|
|
559
562
|
const noDuplicates2 = [...new Set(newPassages)]
|
|
560
563
|
const parsed = this.parse(noDuplicates2.join(" // ")).getPassages()
|
|
561
564
|
return this.join(parsed)
|