scripture-guide 1.0.54 → 1.0.56

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/data/coc.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = {start:31105,books:{"1 Nephi":[174,100,255,62,262,56,68],"2 Nephi":[126,48,64,51,114,106,43,100,137,54,160,98,31,12,18],"Jacob":[19,69,151,18,45],"Enos":[45],"Jarom":[32],"Omni":[52],"Words of Mormon":[27],"Mosiah":[129,49,21,9,86,58,124,91,181,19,207,26,68],"Alma":[129,28,108,9,44,42,50,108,73,111,32,219,82,127,68,260,83,17,115,99,186,44,44,79,63,168,58,26,62,21],"Helaman":[52,168,132,73,140],"3 Nephi":[57,109,70,75,115,37,45,74,106,41,33,34,62,2],"4 Nephi":[59],"Mormon":[89,54,32,103],"Ether":[116,5,102,115,41,109],"Moroni":[4,3,3,4,3,9,53,35,28,30]},mutlis:{2:{"1 Nephi":{1:[1,76,122,169],3:[238]},"2 Nephi":{1:[33],8:[30,96],11:[146,157],12:[12,31]},"Jacob":{3:[30]},"Mosiah":{7:[94,108,114,117],8:[29,46],9:[21,142,164],11:[50,187],13:[7]},"Alma":{4:[3],6:[6],7:[7],8:[24,62],9:[19],13:[24],14:[49,59,99],15:[5,12,42,65],16:[13,46,87,88,90,128,158,162,181,188,202,203,218,220,238,239],17:[5,7,31,63],18:[15],19:[20,59,67,78,105],20:[9,35,70],21:[5,6,37,45,107],22:[16],25:[5,38,43,61],26:[5,15,52],27:[18,28,45],28:[1],29:[58]},"Helaman":{2:[10,14,25,26,35,39,77,96,112,141],3:[0,16,29,40,82,101],4:[4,38,47,59,60,61],5:[80]},"3 Nephi":{1:[43,44,45,52],2:[76,100],3:[8,10],4:[7,8,9,11,51,53,55],5:[8,11,14,17,25,78,91,92,107,109],6:[36,37],7:[13,15,16,43],8:[7,24],9:[10,20,32,43,48,69,101,106],12:[1,6,11,18,34],13:[1,6,39]},"4 Nephi":{1:[9,28,35]},"Mormon":{1:[7,27,80],3:[13,15,18,24],4:[3,26,37,85]},"Ether":{1:[16,84,113],2:[2],3:[62,94],4:[1,13,18,51,69,91],5:[16,32,40],6:[2,93]},"Moroni":{3:[2],6:[1,6,7],7:[4,8,52],8:[1,17,29],9:[10,23],10:[4,16,30]}},3:{"Alma":{8:[59,60],21:[124]},"Helaman":{3:[97]},"3 Nephi":{5:[82],8:[51]},"Moroni":{10:[10]}},4:{"Alma":{8:[61]},"Moroni":{9:[12]}},5:{"Alma":{14:[13],16:[219]},"Moroni":{10:[11]}},27:{"Ether":{1:[6]}}}};
@@ -11,7 +11,7 @@ const findMatches = (content,books,lang_extra) => {
11
11
  const tail = lang_extra.tail ? new RegExp(lang_extra.tail,"ig") : /[^0-9]+$/;
12
12
  const preBookMatch = lang_extra.book || `(First|I|1|1st|Second|II|2|2nd|Third|III|3|3rd|Fourth|IV|4|4th)*\\s*(books* of)*\\s*`;
13
13
  const matchingBooks = findMatchingBooks(content,books);
14
- const postBookMatch = lang_extra.chapter || "([0-9:.;,~ —–]|cf|(?:–))*[0-9]+";
14
+ const postBookMatch = lang_extra.chapter || "([0-9:.;,~ —–-]|cf|(?:–))*[0-9]+";
15
15
  const fullBookMatches = matchingBooks.map(bookMatch=>{
16
16
  const patternString = preBookMatch + bookMatch ;
17
17
  const pattern = (new RegExp(patternString,"ig"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scripture-guide",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "A utility for biblical and scripture reference parsing that enables structured queries based on strings of traditional scripture references (e.g. John 3:16). ",
5
5
  "main": "scriptures-compiled.js",
6
6
  "scripts": {
@@ -32,7 +32,7 @@ var _require = require('./data/scriptdetect.js'),
32
32
  processReferenceDetection = _require.processReferenceDetection;
33
33
  var setLanguage = function setLanguage(language) {
34
34
  var _raw_lang$lang, _raw_lang$lang2, _raw_lang$lang3, _raw_lang$lang4, _raw_lang$lang5;
35
- if (lang === language) return console.log("Language already set to ".concat(lang));
35
+ if (lang === language) return; // console.log(`Language already set to ${lang}`);
36
36
  lang = language;
37
37
  refIndex = null;
38
38
  verseIdIndex = null;
@@ -247,7 +247,8 @@ var handleSingleChapterBookRefs = function handleSingleChapterBookRefs(ref) {
247
247
  }),
248
248
  _singleChapterBooks$f2 = _slicedToArray(_singleChapterBooks$f, 1),
249
249
  matchingBook = _singleChapterBooks$f2[0];
250
- ref = ref.replace(new RegExp("^".concat(matchingBook, " ([^:]+)$")), "".concat(matchingBook, " 1:$1"));
250
+ if (new RegExp("^".concat(matchingBook, " 1:")).test(ref)) return ref;
251
+ ref = ref.replace(new RegExp("^".concat(matchingBook, " (\\d+)")), "".concat(matchingBook, " 1:$1"));
251
252
  return ref;
252
253
  };
253
254
  var splitReferences = function splitReferences(compoundReference) {
package/scriptures.js CHANGED
@@ -13,7 +13,7 @@ let {prepareBlacklist, preparePattern,processReferenceDetection} = require('./da
13
13
 
14
14
  const setLanguage = function(language) {
15
15
 
16
- if(lang===language) return console.log(`Language already set to ${lang}`);
16
+ if(lang===language) return;// console.log(`Language already set to ${lang}`);
17
17
  lang = language;
18
18
  refIndex = null
19
19
  verseIdIndex = null
@@ -238,7 +238,8 @@ const handleSingleChapterBookRefs = function(ref) {
238
238
 
239
239
  const singleChapterBooks = Object.keys(raw_index).filter(book => loadMaxChapter(book) == 1);
240
240
  const [matchingBook] = singleChapterBooks.filter(book => ref.match(new RegExp(`^${book} \\d+`)));
241
- ref = ref.replace(new RegExp(`^${matchingBook} ([^:]+)$`),`${matchingBook} 1:$1`);
241
+ if(new RegExp(`^${matchingBook} 1:`).test(ref)) return ref;
242
+ ref = ref.replace(new RegExp(`^${matchingBook} (\\d+)`), `${matchingBook} 1:$1`);
242
243
  return ref;
243
244
  }
244
245
 
package/test/data/en.txt CHANGED
@@ -1,2 +1 @@
1
- see 1 Nephi 13:12 and 1 Nephi 13
2
- * separately under 2 Nephi 2:10–11 in part 1
1
+ Peter testified that Christ was the “lamb without blemish and without spot, who verily was foreordained before the foundation of the world” (1 Peter 1:19-20). In the words of John the Revelator, Christ was the “Lamb slain from the foundation of the world” (Revelation 13:8). Such expressions affirm that the plan of salvation was known and taught even before the creation of the earth (see D&C 132:8-11).