scripture-guide 1.0.13 → 1.0.14

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scripture-guide",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
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": {
@@ -485,6 +485,7 @@ var loadMaxVerse = function loadMaxVerse(book, chapter) {
485
485
  return raw_index[book][parseInt(chapter) - 1];
486
486
  };
487
487
  var detectReferences = function detectReferences(content, callBack) {
488
+ var _content$match;
488
489
  callBack = callBack ? callBack : function (i) {
489
490
  return "[".concat(i, "]");
490
491
  };
@@ -499,12 +500,12 @@ var detectReferences = function detectReferences(content, callBack) {
499
500
  });
500
501
  var pattern = preparePattern(bookMatchList, wordBreak = "", lang_extra);
501
502
  var blacklist_pattern = prepareBlacklist();
502
- var matches = content.match(pattern).filter(function (i) {
503
+ var matches = ((_content$match = content.match(pattern)) === null || _content$match === void 0 ? void 0 : _content$match.filter(function (i) {
503
504
  return !blacklist_pattern.test(i);
504
- });
505
+ })) || [];
505
506
 
506
507
  //split by matches
507
- var pieces = content.split(new RegExp("(".concat(matches.join("|"), ")"), "ig"));
508
+ var pieces = content.split(new RegExp("(".concat(matches.join("|"), ")"), "ig")) || [];
508
509
  content = pieces.map(function (i, j) {
509
510
  if (j % 2 == 0) return i;
510
511
  return callBack(i);
package/scriptures.js CHANGED
@@ -486,10 +486,10 @@ const detectReferences = (content,callBack) => {
486
486
  const bookMatchList = [...dst, ...src].map(i => [i]);
487
487
  const pattern = preparePattern(bookMatchList,wordBreak="",lang_extra);
488
488
  const blacklist_pattern = prepareBlacklist();
489
- var matches = content.match(pattern).filter(i=>!blacklist_pattern.test(i));
489
+ var matches = content.match(pattern)?.filter(i=>!blacklist_pattern.test(i)) || [];
490
490
 
491
491
  //split by matches
492
- const pieces = content.split(new RegExp(`(${matches.join("|")})`, "ig"));
492
+ const pieces = content.split(new RegExp(`(${matches.join("|")})`, "ig")) || [];
493
493
 
494
494
  content = pieces.map((i,j)=>{
495
495
  if(j%2==0) return i;