codexparser 0.2.0 → 0.3.1
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/CHANGELOG.md +29 -0
- package/README.md +76 -0
- package/RELEASE_NOTES_v0.2.0.md +5 -0
- package/RELEASE_NOTES_v0.3.0.md +32 -0
- package/package.json +1 -1
- package/src/core/ReferenceParser.js +18 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. For full details, see the Release Notes in README and the GitHub Releases page.
|
|
4
|
+
|
|
5
|
+
## 0.3.0 — 2026-01-10
|
|
6
|
+
|
|
7
|
+
- Added `convertVersion(targetVersion)` method on passage objects for versification conversion.
|
|
8
|
+
- Accepts version string: `"eng"`, `"lxx"`, `"mt"`, or `"bhs"` (alias for MT).
|
|
9
|
+
- Automatically converts chapter/verse references between versifications when versification data exists.
|
|
10
|
+
- Returns same reference with updated version metadata if no versification exists.
|
|
11
|
+
- Tested with Psalms, Zechariah, and NT passages.
|
|
12
|
+
- Published to npm as `codexparser@0.3.0`.
|
|
13
|
+
|
|
14
|
+
See the release: https://github.com/jeremyam/CodexParser/releases/tag/v0.3.0
|
|
15
|
+
|
|
16
|
+
## 0.2.0 — 2026-01-10
|
|
17
|
+
|
|
18
|
+
- Refactored internal architecture into clear folders:
|
|
19
|
+
- `src/core` (parser, scanner, validator, collection, version/versification handlers)
|
|
20
|
+
- `src/utils` (helpers, regex, chapter-verse data loader)
|
|
21
|
+
- `src/format` (OSIS formatter, abbreviations)
|
|
22
|
+
- `src/data` (bible lists, chapter_verses, versifications, sbl abbreviations)
|
|
23
|
+
- Adopted OSIS textual hashes (e.g., `John.3.16`, `Rev.1.8-Rev.2.17`).
|
|
24
|
+
- Added numeric OSIS using pythonbible-style integer verse IDs (`book*1_000_000 + chapter*1_000 + verse`).
|
|
25
|
+
- Attached per-passage version helpers: `getVersion()`, `getLXX()`, `getMT()`, `getBHS()`, `getEnglish()`.
|
|
26
|
+
- Cleaned dependencies and removed vulnerable toolchain; `npm audit` is clean.
|
|
27
|
+
- Published to npm as `codexparser@0.2.0`.
|
|
28
|
+
|
|
29
|
+
See the release: https://github.com/jeremyam/CodexParser/releases/tag/v0.2.0
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# CodexParser: The Ultimate Bible Reference Parser 📖✨
|
|
2
2
|
|
|
3
|
+
[](https://github.com/jeremyam/CodexParser/releases)
|
|
4
|
+
|
|
3
5
|
Welcome to **CodexParser**, a powerful and flexible Node.js library crafted to parse, validate, and structure Bible references with ease. Whether you're extracting verses from a sermon, building a scripture app, or analyzing biblical texts, CodexParser transforms raw references like "John 3:16" or "Psalm 115:5,7,10" into rich, actionable data—complete with start and end points, SBL-style abbreviations, versification support, and validation. Dive into the Word like never before!
|
|
4
6
|
|
|
5
7
|
Built with precision and passion, CodexParser handles single verses, ranges, multi-chapter spans, and single-chapter books (looking at you, Jude!). It’s your trusty companion for navigating the sacred texts, supporting English, Septuagint (LXX), and Masoretic Text (MT) versions. Let’s unleash its power!
|
|
@@ -38,6 +40,8 @@ npm install
|
|
|
38
40
|
|
|
39
41
|
## Quick Start ⚡
|
|
40
42
|
|
|
43
|
+
For version detection and switching examples, see [Versions & Versification](#versions--versification).
|
|
44
|
+
|
|
41
45
|
Here’s how to wield CodexParser’s might:
|
|
42
46
|
|
|
43
47
|
```javascript
|
|
@@ -100,6 +104,61 @@ console.log(parser.parse("Genesis 1:1-5, 10; 2:1-3").getPassages().combine())
|
|
|
100
104
|
|
|
101
105
|
---
|
|
102
106
|
|
|
107
|
+
## Versions & Versification 🔁
|
|
108
|
+
|
|
109
|
+
CodexParser supports English (`ENG`), Septuagint (`LXX`), and Masoretic (`MT`/`BHS`) versifications. You can set a default via `.bibleVersion()` or use per-passage helpers to convert.
|
|
110
|
+
|
|
111
|
+
- Set default version for parsing:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const CodexParser = require("codexparser")
|
|
115
|
+
const parser = new CodexParser()
|
|
116
|
+
|
|
117
|
+
// Default LXX if no suffix in the input
|
|
118
|
+
parser.bibleVersion("lxx")
|
|
119
|
+
const [p] = parser.parse("Psalms 4:5").getPassages()
|
|
120
|
+
console.log(p.version.abbreviation) // "lxx"
|
|
121
|
+
console.log(p.scripture.hash) // "Ps.4.5"
|
|
122
|
+
|
|
123
|
+
// Convert to English versification
|
|
124
|
+
const eng = p.getEnglish()
|
|
125
|
+
console.log(eng.scripture.cv) // "4:4" (example of LXX→ENG shift)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- Detect version from suffix and convert across versions:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
const CodexParser = require("codexparser")
|
|
132
|
+
const parser = new CodexParser()
|
|
133
|
+
|
|
134
|
+
// Suffix sets version automatically
|
|
135
|
+
const passages = parser.parse("Psalms 94:4-100:6 MT").getPassages()
|
|
136
|
+
const base = passages[0]
|
|
137
|
+
console.log(base.version.abbreviation) // "mt"
|
|
138
|
+
console.log(base.scripture.hash) // e.g., "Ps.94.4-Ps.100.6"
|
|
139
|
+
|
|
140
|
+
// Convert to LXX and ENG with helpers
|
|
141
|
+
const lxx = base.getLXX()
|
|
142
|
+
const eng = base.getEnglish()
|
|
143
|
+
console.log(lxx.scripture.cv) // "93:4-23; 94:1-11; ..." (mapped LXX ranges)
|
|
144
|
+
console.log(eng.scripture.cv) // "94:4-23; 95:1-11; ..." (ENG/MT alignment)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
- Zechariah example (chapter offsets):
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const parser = new CodexParser()
|
|
151
|
+
const [z] = parser.parse("Zechariah 2:8").getPassages()
|
|
152
|
+
console.log(z.getEnglish().scripture.hash) // "Zech.2.8"
|
|
153
|
+
console.log(z.getLXX().scripture.hash) // "Zech.2.12" (LXX mapping)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Notes:
|
|
157
|
+
- `getVersion("eng"|"lxx"|"mt"|"bhs")` is available; `getBHS()` aliases `MT`.
|
|
158
|
+
- `.scripture.hash` is OSIS textual (e.g., `John.3.16`), `.osisNumeric` uses pythonbible-style integer IDs.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
103
162
|
## API: Your Codex Arsenal 🛠️
|
|
104
163
|
|
|
105
164
|
Here’s the breakdown of CodexParser’s key methods—your tools for mastering scripture:
|
|
@@ -240,3 +299,20 @@ Built with love by [jeremyam], powered by coffee and scripture.
|
|
|
240
299
|
---
|
|
241
300
|
|
|
242
301
|
Let’s parse the scriptures together—happy coding! ✝️📚
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Release Notes
|
|
306
|
+
|
|
307
|
+
### 0.2.0 (2026-01-10)
|
|
308
|
+
|
|
309
|
+
- Refactored internal architecture into clear folders:
|
|
310
|
+
- `src/core` (parser, scanner, validator, collection, version/versification handlers)
|
|
311
|
+
- `src/utils` (helpers, regex, chapter-verse data loader)
|
|
312
|
+
- `src/format` (OSIS formatter, abbreviations)
|
|
313
|
+
- `src/data` (bible lists, chapter_verses, versifications, sbl abbreviations)
|
|
314
|
+
- Adopted OSIS textual hashes (e.g., `John.3.16`, `Rev.1.8-Rev.2.17`).
|
|
315
|
+
- Added numeric OSIS using pythonbible-style integer verse IDs (`book*1_000_000 + chapter*1_000 + verse`).
|
|
316
|
+
- Attached per-passage version helpers: `getVersion()`, `getLXX()`, `getMT()`, `getBHS()`, `getEnglish()`.
|
|
317
|
+
- Cleaned dependencies and removed vulnerable toolchain; `npm audit` is clean.
|
|
318
|
+
- Published to npm as `codexparser@0.2.0`.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# CodexParser 0.2.0
|
|
2
|
+
|
|
3
|
+
Refactor into core/utils/format/data; OSIS textual hashes (e.g., John.3.16); pythonbible-style integer verse IDs for `osisNumeric`; per-passage version helpers (`getVersion/getLXX/getMT/getBHS/getEnglish`); dependency cleanup and audit fix; published to npm as `codexparser@0.2.0`.
|
|
4
|
+
|
|
5
|
+
See detailed notes in README under "Release Notes" → 0.2.0.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# CodexParser 0.3.0
|
|
2
|
+
|
|
3
|
+
Added `convertVersion(targetVersion)` method on passage objects for versification conversion.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **New Method**: `passage.convertVersion(targetVersion)` accepts version string (`"eng"`, `"lxx"`, `"mt"`, or `"bhs"`).
|
|
8
|
+
- **Smart Conversion**: Automatically converts chapter/verse references between versifications when versification data exists (e.g., Psalms, Zechariah).
|
|
9
|
+
- **Fallback Behavior**: Returns same reference with updated version metadata if no versification exists (e.g., NT passages).
|
|
10
|
+
- **Tested**: Verified with Psalms, Zechariah, and NT passages.
|
|
11
|
+
|
|
12
|
+
## Usage Example
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
const CodexParser = require("codexparser")
|
|
16
|
+
const parser = new CodexParser()
|
|
17
|
+
|
|
18
|
+
// Convert English reference to LXX
|
|
19
|
+
const [p] = parser.parse("Psalm 4:5").getPassages()
|
|
20
|
+
console.log(p.scripture.hash) // "Ps.4.5"
|
|
21
|
+
|
|
22
|
+
const lxx = p.convertVersion("lxx")
|
|
23
|
+
console.log(lxx.scripture.hash) // "Ps.4.6"
|
|
24
|
+
|
|
25
|
+
// No versification (NT) - returns same reference
|
|
26
|
+
const [j] = parser.parse("John 3:16").getPassages()
|
|
27
|
+
const jLxx = j.convertVersion("lxx")
|
|
28
|
+
console.log(jLxx.scripture.hash) // "John.3.16" (same)
|
|
29
|
+
console.log(jLxx.version.abbreviation) // "lxx" (version updated)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
See full CHANGELOG: https://github.com/jeremyam/CodexParser/blob/main/CHANGELOG.md
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
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": {
|
|
@@ -267,6 +267,22 @@ class ReferenceParser {
|
|
|
267
267
|
passage.getEnglish = function () {
|
|
268
268
|
return this.getVersion("eng")
|
|
269
269
|
}
|
|
270
|
+
passage.convertVersion = function (targetVersion) {
|
|
271
|
+
const targetAbbr = targetVersion.toLowerCase() === "bhs" ? "mt" : targetVersion.toLowerCase()
|
|
272
|
+
|
|
273
|
+
// Check if any passages have versification data
|
|
274
|
+
const hasVersification = this.passages.some((p) => p.versification)
|
|
275
|
+
|
|
276
|
+
if (!hasVersification) {
|
|
277
|
+
// No versification exists, return a clone with updated version info only
|
|
278
|
+
const cloned = JSON.parse(JSON.stringify(this))
|
|
279
|
+
cloned.version = VersionHandler.getVersionObject(targetAbbr)
|
|
280
|
+
return cloned
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Has versification, use the full conversion
|
|
284
|
+
return computeConverted(this, targetAbbr)
|
|
285
|
+
}
|
|
270
286
|
}
|
|
271
287
|
|
|
272
288
|
/**
|
|
@@ -330,8 +346,8 @@ class ReferenceParser {
|
|
|
330
346
|
}
|
|
331
347
|
}
|
|
332
348
|
|
|
333
|
-
// Handle chapter-only references
|
|
334
|
-
if (!part.includes(":") && !part.includes("-") && !singleChapterBook) {
|
|
349
|
+
// Handle chapter-only references (only when no chapter has been established yet)
|
|
350
|
+
if (!part.includes(":") && !part.includes("-") && !singleChapterBook && !passage.chapter) {
|
|
335
351
|
this.#parseChapterOnly(passage, part)
|
|
336
352
|
} else if (part.includes(":")) {
|
|
337
353
|
this.#parseChapterVerse(passage, part, isFirstPart)
|