codexparser 0.0.55 → 0.0.57

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.
@@ -5,14 +5,17 @@ const dump = (item) => {
5
5
  console.log(util.inspect(item, { depth: null, colors: true }))
6
6
  }
7
7
 
8
- const parser = new CodexParser()
8
+ const parser = new CodexParser({
9
+ invalid_sequence_strategy: "include",
10
+ invalid_passage_strategy: "include",
11
+ })
9
12
  const text =
10
13
  "Joel 10:13 The passages Luke 2:32 and Lk 1:23 that we are looking at tonight 1 Cor 12:34 2 Cor 3:4 are found Jude 6, in Jude 5, Genesis 2:1 - 3:19, 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles. Ps 109:4,5,6,8. Isaiah 61.2-3 Mt 5.4"
11
14
  const single = "Ge 27.27-29,89-40 Heb 11.20 Heb. 12.17 Jonah 3"
12
15
  const jd = "Jd. 5"
13
16
  const cor = "1 Cor 12:4 2 Cor 3:4"
14
17
  const noSpace = "Re13.8"
15
- const passages = parser.parse(text)
18
+ const passages = parser.parse(text + single + jd + cor + noSpace)
16
19
  passages.getPassages().forEach((passage) => {
17
20
  dump(passage)
18
21
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
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": {
@@ -132,23 +132,22 @@ class CodexParser {
132
132
  }
133
133
 
134
134
  versify(passage) {
135
- const singleBooks = ["Obadiah", "Philemon", "2 John", "3 John", "Jude"]
136
- if (passage.start.b && singleBooks.includes(passage.start.b)) {
137
- return [passage.start.v + "-" + passage.end.v]
138
- } else {
139
- if (passage.start.v !== passage.end.v) {
140
- if (passage.type === "range") {
141
- return [`${passage.start.v}-${passage.end.v}`]
142
- } else {
135
+ if (passage.start.v !== passage.end.v) {
136
+ if (passage.type === "range") {
137
+ return [`${passage.start.v}-${passage.end.v}`]
138
+ } else {
139
+ if (passage.type !== "bc") {
143
140
  const verses = []
144
141
  for (let i = passage.start.v; i <= passage.end.v; i++) {
145
142
  verses.push(i)
146
143
  }
147
144
  return verses
145
+ } else {
146
+ return [passage.start.v + "-" + passage.end.v]
148
147
  }
149
- } else {
150
- return [passage.start.v]
151
148
  }
149
+ } else {
150
+ return [passage.start.v]
152
151
  }
153
152
  }
154
153
 
@@ -4,7 +4,7 @@ const util = require("util")
4
4
  const dump = (item) => {
5
5
  console.log(util.inspect(item, { depth: null, colors: true }))
6
6
  }
7
- const string = "Joel 4:13 Mark 4:29 Revelation 14:15,18,19"
7
+ const string = "Gen 1 Jd1 Ps 119:2,4,6,8,19"
8
8
  const parser = new BibleParser()
9
9
  const result = parser.parse(string)
10
10
  dump(result.getPassages())