codexparser 0.1.61 → 0.1.62
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 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.62",
|
|
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
|
@@ -93,13 +93,7 @@ class CodexParser {
|
|
|
93
93
|
}
|
|
94
94
|
const detectSuffix = (startIndex) => {
|
|
95
95
|
const suffixMatch = normalizedText.substring(startIndex).match(/\b(LXX|MT)\b/i)
|
|
96
|
-
return suffixMatch
|
|
97
|
-
? {
|
|
98
|
-
suffix: suffixMatch[0].toUpperCase(),
|
|
99
|
-
length:
|
|
100
|
-
suffixMatch[0].length + (normalizedText[startIndex + suffixMatch[0].length] === " " ? 1 : 0),
|
|
101
|
-
}
|
|
102
|
-
: null
|
|
96
|
+
return suffixMatch ? { suffix: suffixMatch[0].toUpperCase(), length: suffixMatch[0].length } : null
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
while (i < lowerCaseText.length) {
|
|
@@ -153,12 +147,10 @@ class CodexParser {
|
|
|
153
147
|
|
|
154
148
|
const suffixData = detectSuffix(i)
|
|
155
149
|
const suffix = suffixData ? suffixData.suffix : null
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (endIndex > 0 && normalizedText[endIndex - 1] === " ") {
|
|
161
|
-
endIndex--
|
|
150
|
+
let endIndex = i // Set endIndex before suffix
|
|
151
|
+
if (suffixData) {
|
|
152
|
+
endIndex += suffixData.length // Include suffix in endIndex
|
|
153
|
+
i += suffixData.length // Advance i
|
|
162
154
|
}
|
|
163
155
|
|
|
164
156
|
references.forEach((ref) => {
|