codexparser 0.0.1 → 0.0.2

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/index.js CHANGED
@@ -1,8 +1,2 @@
1
- import CodexParser from './src/CodexParser.js'
2
-
3
- const parser = new CodexParser();
4
- const text = 'The passages that we are looking at tonight are found in 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles.'
5
- const single = 'Revelation 16:8'
6
- parser.parse(text)
7
- parser.parse(single)
8
- console.log(parser.getPassages())
1
+ const CodexParser = require("./src/CodexParser.js")
2
+ module.exports = { CodexParser }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
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": {
@@ -9,7 +9,6 @@
9
9
  },
10
10
  "author": "Jeremy Menicucci",
11
11
  "license": "ISC",
12
- "type": "module",
13
12
  "devDependencies": {
14
13
  "@babel/cli": "^7.23.9",
15
14
  "@babel/core": "^7.24.0",
@@ -1,5 +1,5 @@
1
- import { bible } from "./bible.js"
2
- import { bookRegex, bookAbbrRegex, chapterRegex, verseRegex, scripturesRegex, abbrScripturesRegex } from "./regex.js"
1
+ const bible = require("./bible")
2
+ const { bookRegex, bookAbbrRegex, chapterRegex, verseRegex, scripturesRegex, abbrScripturesRegex } = require("./regex")
3
3
 
4
4
  class CodexParser {
5
5
  constructor() {
@@ -44,16 +44,16 @@ class CodexParser {
44
44
  original: this.found[i],
45
45
  book: book[0].charAt(0).toUpperCase() + book[0].slice(1),
46
46
  chapter: chapter[0].replace(":", "").trim(),
47
- verse: this.found[i].match(this.verseRegex)[0].replace(":", "").trim(),
47
+ verses: this.found[i].match(this.verseRegex)[0].replace(":", "").trim(),
48
48
  }
49
- passage.verse = passage.verse.split(/,/).filter(Boolean)
49
+ passage.verses = passage.verses.split(/,/).filter(Boolean)
50
50
  passage.testament = this.bible.old.includes(passage.book) ? "old" : "new"
51
51
  this.passages.push(passage)
52
52
  }
53
53
  this.found = []
54
54
  return this.passages
55
55
  }
56
-
56
+ //TODO: Need to create a bookfiy function that will convert abbreviated books into full books
57
57
  /**
58
58
  * Returns the passages stored in the object.
59
59
  *
@@ -64,4 +64,4 @@ class CodexParser {
64
64
  }
65
65
  }
66
66
 
67
- export default CodexParser
67
+ module.exports = CodexParser
package/src/bible.js CHANGED
@@ -1,4 +1,4 @@
1
- export const bible = {
1
+ module.exports = {
2
2
  old: [
3
3
  "Genesis",
4
4
  "Exodus",
@@ -69,4 +69,4 @@ export const bible = {
69
69
  "Jude",
70
70
  "Revelation",
71
71
  ],
72
- }
72
+ }
package/src/regex.js CHANGED
@@ -1,14 +1,15 @@
1
- export const bookRegex =
2
- /(?:(?:[gG]en(?:esis)?|[eE]xod(?:us)?|[lL]ev(?:iticus)?|[nN]um(?:bers)?|[dD]eu(?:teronomy)?|[jJ]os(?:hua)?|[jJ]dg(?:es)?|[rR]ut(?:h)?|1 [sS]a(?:muel)?|2 [sS]a(?:muel)?|1 [kK]gs(?:on)?|2 [kK]gs(?:on)?|1 [cC]hr(?:onicles)?|2 [cC]hr(?:onicles)?|[eE]zr(?:a)?|[nN]eh(?:emiah)?|[eE]st(?:her)?|[jJ]ob|[pP]sa(?:lms)?|[pP]ro(?:verbs)?|[eE]cc(?:lesiastes)?|[sS]on(?:g)?|[iI]sa(?:iah)?|[jJ]er(?:emiah)?|[lL]am(?:entations)?|[eE]ze(?:riah)?|[dD]an(?:iel)?|[hH]o(?:sea)?|[jJ]oe(?:l)?|[aA]mo(?:s)?|[oO]ba(?:h)?|[jJ]on(?:ah)?|[mM]i(?:cah)?|[nN]ah(?:um)?|[hH]ab(?:akkuk)?|[zZ]ep(?:haniah)?|[hH]ag(?:gai)?|[zZ]ec(?:hariah)?|[mM]al(?:achi)?|[mM]at(?:thew)?|[mM]ar(?:k)?|[lL]uk(?:e)?|[jJ]oh(?:n)?|[aA]ct(?:s)?|[rR]om(?:s)?|1 [cC]or(?:inthians)?|2 [cC]or(?:inthians)?|[gG]al(?:atians)?|[eE]ph(?:esians)?|[pP]hi(?:lippians)?|[cC]ol(?:ossians)?|1 [tT]hess(?:alonians)?|2 [tT]hess(?:alonians)?|1 [tT]i(?:mothy)?|2 [tT]i(?:mothy)?|[tT]it(?:us)?|[pP]h(?:ilemon)?|[hH]eb(?:rews)?|[jJ]am(?:es)?|1 [pP]e(?:ter)?|2 [pP]e(?:ter)?|1 [jJ]o(?:n)?|2 [jJ]o(?:n)?|3 [jJ]o(?:n)?|[jJ]ude?|Rev(?:elation)?))/gim
3
- export const bookAbbrRegex =
1
+ const bookRegex =
2
+ /(?:(?:[gG]en(?:esis)?|[eE]xod(?:us)?|[lL]ev(?:iticus)?|[nN]um(?:bers)?|[dD]eu(?:teronomy)?|[jJ]os(?:hua)?|[jJ]dg(?:es)?|[rR]ut(?:h)?|1 [sS]a(?:muel)?|2 [sS]a(?:muel)?|1 [kK]gs(?:on)?|2 [kK]gs(?:on)?|1 [cC]hr(?:onicles)?|2 [cC]hr(?:onicles)?|[eE]zr(?:a)?|[nN]eh(?:emiah)?|[eE]st(?:her)?|[jJ]ob|[pP]sa(?:lms)?|[pP]ro(?:verbs)?|[eE]cc(?:lesiastes)?|[sS]on(?:g)?|[iI]sa(?:iah)?|[jJ]er(?:emiah)?|[lL]am(?:entations)?|[eE]ze(?:riah)?|[dD]an(?:iel)?|[hH]o(?:sea)?|[jJ]oe(?:l)?|[aA]mo(?:s)?|[oO]ba(?:h)?|[jJ]on(?:ah)?|[mM]i(?:cah)?|[nN]ah(?:um)?|[hH]ab(?:akkuk)?|[zZ]ep(?:haniah)?|[hH]ag(?:gai)?|[zZ]ec(?:hariah)?|[mM]al(?:achi)?|[mM]at(?:thew)?|[mM]ar(?:k)?|[lL]uk(?:e)?|[jJ]oh(?:n)?|[aA]ct(?:s)?|[rR]o(?:m)?(?:ans)?|1 [cC]or(?:inthians)?|2 [cC]or(?:inthians)?|[gG]al(?:atians)?|[eE]ph(?:esians)?|[pP]hi(?:lippians)?|[cC]ol(?:ossians)?|1 [tT]hess(?:alonians)?|2 [tT]hess(?:alonians)?|1 [tT]i(?:mothy)?|2 [tT]i(?:mothy)?|[tT]it(?:us)?|[pP]h(?:ilemon)?|[hH]eb(?:rews)?|[jJ]am(?:es)?|1 [pP]e(?:ter)?|2 [pP]e(?:ter)?|1 [jJ]o(?:n)?|2 [jJ]o(?:n)?|3 [jJ]o(?:n)?|[jJ]ude?|Rev(?:elation)?))/gim
3
+ const bookAbbrRegex =
4
4
  /(?:(?:[gG]en|[eE]xo|[lL]ev|[nN]um|[dD]eu|[jJ]os|[jJ]dg|[rR]ut|1 [sS]a|2 [sS]a|1 [kK]gs|2 [kK]gs|1 [cC]hr|2 [cC]hr|[eE]zr|[nN]eh|[eE]st|[jJ]ob|[pP]sa|[pP]ro|[eE]cc|[sS]on|[iI]sa|[jJ]er|[lL]am|[eE]ze|[dD]an|[hH]os|[jJ]oe|[aA]mo|[oO]ba|[jJ]on|[mM]ic|[nN]ah|[hH]ab|[zZ]ep|[hH]ag|[zZ]ec|[mM]al|[mM]att|[mM]ar|[lL]uk|[jJ]oh|[aA]ct|[rR]om|1 [cC]or|2 [cC]or|[gG]al|[eE]ph|[pP]hi|[cC]ol|1 [tT]hess|2 [tT]hess|1 [tT]i|2 [tT]i|[tT]it|[pP]hm|[hH]eb|[jJ]am|1 [pP]e|2 [pP]e|1 [jJ]o|2 [jJ]o|3 [jJ]o|[jJ]ud|[rR]ev))/gim
5
- export const chapterRegex = /(?:\s?\d+:?)/g
6
- export const verseRegex = /\b:\s*?(\d+(?:,?\s*?\d+?|-|–|—\d+)*)?\d+(?!p|j|k|s|c|t)\b/g
7
- export const scripturesRegex = new RegExp(
8
- `(${bookRegex.source})(${chapterRegex.source})?(${verseRegex.source})`,
9
- "gm"
10
- )
11
- export const abbrScripturesRegex = new RegExp(
12
- `(${bookAbbrRegex.source})(${chapterRegex.source})?(${verseRegex.source})`,
13
- "gm"
14
- )
5
+ const chapterRegex = /(?:\s?\d+:?)/g
6
+ const verseRegex = /\b:\s*?(\d+(?:,?\s*?\d+?|-|–|—\d+)*)?\d+(?!p|j|k|s|c|t)\b/g
7
+ const scripturesRegex = new RegExp(`(${bookRegex.source})(${chapterRegex.source})?(${verseRegex.source})`, "gm")
8
+ const abbrScripturesRegex = new RegExp(`(${bookAbbrRegex.source})(${chapterRegex.source})?(${verseRegex.source})`, "gm")
9
+
10
+ module.exports.bookRegex = bookRegex
11
+ module.exports.bookAbbrRegex = bookAbbrRegex
12
+ module.exports.chapterRegex = chapterRegex
13
+ module.exports.scripturesRegex = scripturesRegex
14
+ module.exports.abbrScripturesRegex = abbrScripturesRegex
15
+ module.exports.verseRegex = verseRegex
package/test.js ADDED
@@ -0,0 +1,9 @@
1
+ const CodexParser = require("./src/CodexParser.js")
2
+
3
+ const parser = new CodexParser()
4
+ const text =
5
+ "The passages that we are looking at tonight are found in 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles."
6
+ const single = "Revelation 16:8"
7
+ parser.parse(text)
8
+ //parser.parse(single)
9
+ console.log(parser.getPassages())