scripture-guide 1.0.41 → 1.0.42
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/scriptdetect.js +11 -7
- package/package.json +1 -1
- package/test/data/en.txt +4 -1
package/data/scriptdetect.js
CHANGED
|
@@ -22,21 +22,29 @@ const findMatches = (content,books,lang_extra) => {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
const bookSubStrings = fullBookMatches.map(bookMatch=>{
|
|
25
|
-
const matchCount = content.match(new RegExp(bookMatch,"ig")).length;
|
|
26
25
|
const substrings = content.match(new RegExp(bookMatch,"ig")).flat();
|
|
27
26
|
return substrings;
|
|
28
27
|
}).flat().reduce((prev,current)=>{
|
|
29
28
|
if(prev.includes(current)) return prev;
|
|
30
29
|
return [...prev,current]
|
|
31
30
|
},[]).filter(i=>!!i).map(substring=>{
|
|
31
|
+
substring = substring.trim();
|
|
32
32
|
let positions = [];
|
|
33
33
|
let index = content.indexOf(substring);
|
|
34
34
|
while (index != -1) {
|
|
35
35
|
positions.push(index);
|
|
36
36
|
index = content.indexOf(substring, index + 1);
|
|
37
37
|
} return [substring,positions];
|
|
38
|
-
})
|
|
39
|
-
|
|
38
|
+
}).map(([substring,positions])=>{
|
|
39
|
+
const preChars = positions.map(i=>content.substring(i-1,i));
|
|
40
|
+
positions = positions.filter((i,index)=>{
|
|
41
|
+
const charRightBeforeMatch = preChars[index];
|
|
42
|
+
const leadingCharIsInvalid = !/^(\s|\W|)$/.test(charRightBeforeMatch);
|
|
43
|
+
return !leadingCharIsInvalid;
|
|
44
|
+
});
|
|
45
|
+
if(!positions.length) return false;
|
|
46
|
+
return [substring,positions];
|
|
47
|
+
}).filter(i=>!!i);
|
|
40
48
|
|
|
41
49
|
const possiblyOverlappingMatches = bookSubStrings.map(([substring,positions])=>{
|
|
42
50
|
return positions.map(i=>{
|
|
@@ -95,10 +103,6 @@ function findMatchIndexes(content, matches,lookupReference, lang_extra) {
|
|
|
95
103
|
.map(a=>{
|
|
96
104
|
|
|
97
105
|
const substring = content.substring(a[0],a[1]).replace(tail,"").trim();
|
|
98
|
-
const charRightBeforeMatch = content.substring(a[0]-1,a[0]);
|
|
99
|
-
const leadingCharIsInvalid = !/^(\s|\W|)$/.test(charRightBeforeMatch);
|
|
100
|
-
// console.log({substring, charRightBeforeMatch, leadingCharIsInvalid});
|
|
101
|
-
if(leadingCharIsInvalid) return false;
|
|
102
106
|
const verse_ids = lookupReference(substring).verse_ids;
|
|
103
107
|
//console.log({a,substring,verse_ids});
|
|
104
108
|
if(verse_ids.length > 0) return [a[0],a[0]+substring.length];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripture-guide",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
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": {
|
package/test/data/en.txt
CHANGED
|
@@ -7,4 +7,7 @@ The fruit mentioned in 1 Nephi 8:9-12 represents something desirable and joyous.
|
|
|
7
7
|
In accordance with David’s last words at 2 Sam 23.3 (cf. Mos 23.8; 29.16). The Davidic reference may have been included as a conciliatory gesture to his descendants among the Mulekites. The reading in P (“thereby”) implies that keeping the commandments leads to rejoicing and love.
|
|
8
8
|
As Jacob’s priestly lineage comes to an end, the transferal of the plates to Benjamin means that both the Large and Small Plates of Nephi are in the possession of the Nephite kings; cf. WoM 1.10. Amaleki’s reference to spiritual gifts and his assertion about the sources of good and evil will be repeated at Moro 7.12, 16–17; 10.13–16; cf. Alma 5.40. The order of gifts listed generally reflects 1 Cor 12.10.
|
|
9
9
|
Consistently D&C 3:16-17 no "Samites" Mormon 1:8 mentioned across the board in Restoration scripture; cf. Jacob 1:13; 4 Nephi 1:38; Mormon 1:8; D&C 3:17-18
|
|
10
|
-
The Nephites thought of themselves as living on an island, and they believed that other groups of Israelites had been led away by God to other islands as well; see 1 Ne 19.10,15–16;21.1,8;22.3–4;2 Ne 10.7–8;29.7. Note also the mention of “isles” in Isa 51.5, which Jacob quoted at 2 Ne 8.5.
|
|
10
|
+
The Nephites thought of themselves as living on an island, and they believed that other groups of Israelites had been led away by God to other islands as well; see 1 Ne 19.10,15–16;21.1,8;22.3–4;2 Ne 10.7–8;29.7. Note also the mention of “isles” in Isa 51.5, which Jacob quoted at 2 Ne 8.5.
|
|
11
|
+
There is a difference between being reconciled to the will of God (accepting the contingencies of salvation history, even as they may apply negatively to one’s posterity), unique here, and being reconciled unto God (repenting of personal sins in accordance with the plan of salvation), which occurs three times in the NT and four times in the BoM. In the NT, God always reconciles humans to himself through Christ; the BoM, by contrast, invites people to reconcile themselves to God, by availing themselves of Christ’s atonement; cf. 2 Nephi 33.9; Jacob 4.11. Nevertheless, even if salvation requires an element of human volition, the process is initiated and completed through the grace of God; see 2 Nephi 25.23n.
|
|
12
|
+
See Deut 30.19; Jacob2 draws on Lehi1’s elaboration at 2 Ne 2.26–29 as well as on Jeremiah’s allusion at Jer 21.8.
|
|
13
|
+
* In 2 Nephi 9:13 it says, "O how great the plan of our God!" Hugh Nibley notes that the word "plan" is not found in the Bible, yet it's found forty-two times in the Book of Mormon . . . and thirty-six times in the book of Alma. . . . Origen tells us that in the early church they taught that you earned your position here before you came here. So whatever happened to the plan? How did it drop out of the Bible? . . . When the temple was lost the rabbis took over. They were learned men but they were not priests. . . . The philosophers at the School of Alexandria took it over, and in their place you have the doctrines of St. Augustine--this takes the place of the plan. That is, you are predestined to damnation or you are predestined to salvation. . . . This predestination doctrine of St. Augustine was taken over by the Lutherans and by the Calvinists especially. What happens to you is because you were predestined that way. Of course, you didn't live before you came here; you didn't earn it or anything like that. . . . All creation had to be instantaneously, simultaneously complete. Everything was completely there all at once, so you had no background or anything. [Hugh W. Nibley, Teachings of the Book of Mormon, pp. 295-296] [See the commentary on Jarom 1:2; Alma 22:13]
|