json-bible 1.1.3 → 1.1.4
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/lib/api/get.ts +2 -1
- package/lib/reference.ts +1 -1
- package/package.json +1 -1
package/lib/api/get.ts
CHANGED
|
@@ -103,7 +103,8 @@ export default function ApiBibleHelper(key: string, customApiUrl?: string) {
|
|
|
103
103
|
// HTTP
|
|
104
104
|
|
|
105
105
|
export function fetchWrapper(url: string, headers: any, cacheTimeDays: number) {
|
|
106
|
-
|
|
106
|
+
const cached = getCachedContent(url, cacheTimeDays)
|
|
107
|
+
if (cached) return Promise.resolve(cached)
|
|
107
108
|
|
|
108
109
|
// console.info("Fetching:", url)
|
|
109
110
|
return fetch(url, { headers })
|
package/lib/reference.ts
CHANGED
|
@@ -127,7 +127,7 @@ function referenceStringToId(ref: string) {
|
|
|
127
127
|
// "Genesis 1:1-3" = { book: "Genesis ", chapter: 1, verses: [1, 2, 3] }
|
|
128
128
|
function splitReferenceString(ref: string) {
|
|
129
129
|
// (:,.) allowed between chapter/verse - (-+) allowed between verses
|
|
130
|
-
const regex = /(?<book>(?:\d+\.?\s?)?[\p{L}](?:[\p{L}\s']*[\p{L}])?)(?:\s(?<chapter>\d+))?(?:[:,.](?<verses>[0-9,.\-+]+))?/u
|
|
130
|
+
const regex = /(?<book>(?:\d+\.?\s?)?[\p{L}\p{M}](?:[\p{L}\p{M}\s']*[\p{L}\p{M}])?)(?:\s(?<chapter>\d+))?(?:[:,.](?<verses>[0-9,.\-+]+))?/u
|
|
131
131
|
const match = ref.match(regex)
|
|
132
132
|
|
|
133
133
|
if (!match) return { book: "", chapter: "", verses: "" }
|