codexparser 0.1.88 → 0.1.90
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 +48 -16
- package/src/versifications/deuteronomy.js +16 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.90",
|
|
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
|
@@ -957,23 +957,35 @@ class CodexParser {
|
|
|
957
957
|
|
|
958
958
|
passages.forEach((passage) => {
|
|
959
959
|
passage.passages.forEach((p) => {
|
|
960
|
-
|
|
961
|
-
|
|
960
|
+
let normChapter = p.chapter
|
|
961
|
+
let normVerse = p.verse
|
|
962
|
+
if (p.versification && p.versification.eng) {
|
|
963
|
+
const [c, v] = p.versification.eng.split(":").map(Number)
|
|
964
|
+
normChapter = c
|
|
965
|
+
normVerse = v
|
|
962
966
|
}
|
|
963
|
-
chapterVerses[
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
if (firstChapter === null || p.chapter < firstChapter) {
|
|
967
|
-
firstChapter = p.chapter
|
|
968
|
-
firstVerse = p.verse
|
|
969
|
-
} else if (p.chapter === firstChapter && (firstVerse === null || p.verse < firstVerse)) {
|
|
970
|
-
firstVerse = p.verse
|
|
967
|
+
if (!chapterVerses[normChapter]) {
|
|
968
|
+
chapterVerses[normChapter] = new Set()
|
|
971
969
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
970
|
+
chapterVerses[normChapter].add(normVerse)
|
|
971
|
+
combined.passages.push({
|
|
972
|
+
book: p.book,
|
|
973
|
+
chapter: normChapter,
|
|
974
|
+
verse: normVerse,
|
|
975
|
+
versification: p.versification,
|
|
976
|
+
})
|
|
977
|
+
|
|
978
|
+
if (firstChapter === null || normChapter < firstChapter) {
|
|
979
|
+
firstChapter = normChapter
|
|
980
|
+
firstVerse = normVerse
|
|
981
|
+
} else if (normChapter === firstChapter && (firstVerse === null || normVerse < firstVerse)) {
|
|
982
|
+
firstVerse = normVerse
|
|
983
|
+
}
|
|
984
|
+
if (lastChapter === null || normChapter > lastChapter) {
|
|
985
|
+
lastChapter = normChapter
|
|
986
|
+
lastVerse = normVerse
|
|
987
|
+
} else if (normChapter === lastChapter && (lastVerse === null || normVerse > lastVerse)) {
|
|
988
|
+
lastVerse = normVerse
|
|
977
989
|
}
|
|
978
990
|
})
|
|
979
991
|
})
|
|
@@ -1003,12 +1015,18 @@ class CodexParser {
|
|
|
1003
1015
|
throw new Error("No valid verses found in passages.")
|
|
1004
1016
|
}
|
|
1005
1017
|
|
|
1018
|
+
combined.chapter = firstChapter
|
|
1019
|
+
|
|
1006
1020
|
if (firstChapter !== lastChapter) {
|
|
1007
1021
|
combined.type = this.MULTI_CHAPTER_RANGE
|
|
1008
1022
|
combined.to = {
|
|
1009
1023
|
book: combined.book,
|
|
1010
1024
|
chapter: lastChapter,
|
|
1011
|
-
verses: this.mergeRanges(
|
|
1025
|
+
verses: this.mergeRanges(
|
|
1026
|
+
Array.from(chapterVerses[lastChapter])
|
|
1027
|
+
.filter((verse) => verse > 0)
|
|
1028
|
+
.sort((a, b) => a - b)
|
|
1029
|
+
),
|
|
1012
1030
|
}
|
|
1013
1031
|
combined.original = `${combined.book} ${chapterStrings.join("; ")}`
|
|
1014
1032
|
} else {
|
|
@@ -1048,6 +1066,20 @@ class CodexParser {
|
|
|
1048
1066
|
delete combined.to
|
|
1049
1067
|
}
|
|
1050
1068
|
|
|
1069
|
+
// Prefer English version
|
|
1070
|
+
combined.version = { name: "English", value: "ENG", abbreviation: "eng" }
|
|
1071
|
+
|
|
1072
|
+
// Set abbr without version suffix
|
|
1073
|
+
const sblEntry = Object.entries(this.sblAbbreviations).find(
|
|
1074
|
+
([key]) => key.toLowerCase() === combined.book.toLowerCase()
|
|
1075
|
+
)
|
|
1076
|
+
if (sblEntry) {
|
|
1077
|
+
const { value, abbr } = sblEntry[1]
|
|
1078
|
+
combined.abbr = abbr ? `${value}. ${combined.scripture.cv}` : `${value} ${combined.scripture.cv}`
|
|
1079
|
+
} else {
|
|
1080
|
+
combined.abbr = `${combined.book} ${combined.scripture.cv}`
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1051
1083
|
return combined
|
|
1052
1084
|
}
|
|
1053
1085
|
|
|
@@ -95,69 +95,69 @@ module.exports = {
|
|
|
95
95
|
eng: "13:18",
|
|
96
96
|
},
|
|
97
97
|
"14:16": {
|
|
98
|
-
lxx: "14:
|
|
98
|
+
lxx: "14:15",
|
|
99
99
|
mt: "14:16",
|
|
100
100
|
eng: "14:16",
|
|
101
101
|
},
|
|
102
102
|
"14:17": {
|
|
103
|
-
lxx: "14:
|
|
103
|
+
lxx: "14:16",
|
|
104
104
|
mt: "14:17",
|
|
105
105
|
eng: "14:17",
|
|
106
106
|
},
|
|
107
107
|
"14:18": {
|
|
108
|
-
lxx: "14:
|
|
108
|
+
lxx: "14:17",
|
|
109
109
|
mt: "14:18",
|
|
110
110
|
eng: "14:18",
|
|
111
111
|
},
|
|
112
112
|
"14:19": {
|
|
113
|
-
lxx: "14:
|
|
113
|
+
lxx: "14:18",
|
|
114
114
|
mt: "14:19",
|
|
115
115
|
eng: "14:19",
|
|
116
116
|
},
|
|
117
117
|
"14:20": {
|
|
118
|
-
lxx: "14:
|
|
118
|
+
lxx: "14:19",
|
|
119
119
|
mt: "14:20",
|
|
120
120
|
eng: "14:20",
|
|
121
121
|
},
|
|
122
122
|
"14:21": {
|
|
123
|
-
lxx: "14:
|
|
123
|
+
lxx: "14:20",
|
|
124
124
|
mt: "14:21",
|
|
125
125
|
eng: "14:21",
|
|
126
126
|
},
|
|
127
127
|
"14:22": {
|
|
128
|
-
lxx: "14:
|
|
128
|
+
lxx: "14:21",
|
|
129
129
|
mt: "14:22",
|
|
130
130
|
eng: "14:22",
|
|
131
131
|
},
|
|
132
132
|
"14:23": {
|
|
133
|
-
lxx: "14:
|
|
133
|
+
lxx: "14:22",
|
|
134
134
|
mt: "14:23",
|
|
135
135
|
eng: "14:23",
|
|
136
136
|
},
|
|
137
137
|
"14:24": {
|
|
138
|
-
lxx: "14:
|
|
138
|
+
lxx: "14:23",
|
|
139
139
|
mt: "14:24",
|
|
140
140
|
eng: "14:24",
|
|
141
141
|
},
|
|
142
142
|
"14:25": {
|
|
143
|
-
lxx: "14:
|
|
143
|
+
lxx: "14:24",
|
|
144
144
|
mt: "14:25",
|
|
145
145
|
eng: "14:25",
|
|
146
146
|
},
|
|
147
147
|
"14:26": {
|
|
148
|
-
lxx: "14:
|
|
148
|
+
lxx: "14:25",
|
|
149
149
|
mt: "14:26",
|
|
150
150
|
eng: "14:26",
|
|
151
151
|
},
|
|
152
152
|
"14:27": {
|
|
153
|
-
lxx: "14:
|
|
153
|
+
lxx: "14:26",
|
|
154
154
|
mt: "14:27",
|
|
155
155
|
eng: "14:27",
|
|
156
156
|
},
|
|
157
|
-
"14:
|
|
158
|
-
lxx: "14:
|
|
159
|
-
mt: "14:
|
|
160
|
-
eng: "14:
|
|
157
|
+
"14:29": {
|
|
158
|
+
lxx: "14:28",
|
|
159
|
+
mt: "14:29",
|
|
160
|
+
eng: "14:29",
|
|
161
161
|
},
|
|
162
162
|
"22:30": {
|
|
163
163
|
lxx: "23:1",
|