@churchapps/apphelper 0.5.10 → 0.5.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlugHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/SlugHelper.ts"],"names":[],"mappings":"AAEA,qBAAa,UAAU;IAErB,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE;IAY7F,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"SlugHelper.d.ts","sourceRoot":"","sources":["../../src/helpers/SlugHelper.ts"],"names":[],"mappings":"AAEA,qBAAa,UAAU;IAErB,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE;IAY7F,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM;CAUjC"}
|
|
@@ -10,27 +10,13 @@ export class SlugHelper {
|
|
|
10
10
|
const verfiedSlug = this.numerifySlug(initialSlug);
|
|
11
11
|
return verfiedSlug;
|
|
12
12
|
}
|
|
13
|
-
//remove
|
|
13
|
+
//remove long sequences of single-digit numbers (e.g., 1-2-3-4 becomes 1), but preserve normal number patterns
|
|
14
14
|
static numerifySlug(slug) {
|
|
15
15
|
let initialString = slug;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const length = data.length;
|
|
21
|
-
let splitResult = data;
|
|
22
|
-
if (data.includes("-")) {
|
|
23
|
-
splitResult = data.split("-")[0];
|
|
24
|
-
}
|
|
25
|
-
else if (length > 2) {
|
|
26
|
-
splitResult = data.substring(0, 2);
|
|
27
|
-
}
|
|
28
|
-
if (splitResult !== data) {
|
|
29
|
-
const replacedString = initialString.replace(data, splitResult);
|
|
30
|
-
initialString = replacedString;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
16
|
+
// Only match sequences of 3+ single-digit numbers separated by hyphens (e.g., 1-2-3, 1-2-3-4)
|
|
17
|
+
// This avoids mangling things like chapter-verse references (6-11) or dates
|
|
18
|
+
const regex = /\b(\d)-(\d)-(\d)(?:-\d)*\b/g;
|
|
19
|
+
initialString = initialString.replace(regex, "$1");
|
|
34
20
|
return initialString;
|
|
35
21
|
}
|
|
36
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlugHelper.js","sourceRoot":"","sources":["../../src/helpers/SlugHelper.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAO,UAAU;IAErB,MAAM,CAAC,aAAa,CAAC,MAAc,EAAE,IAA2B,EAAE,gBAA2B;QAC3F,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACnI,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC,wDAAwD;QACnF,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACnD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"SlugHelper.js","sourceRoot":"","sources":["../../src/helpers/SlugHelper.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,OAAO,UAAU;IAErB,MAAM,CAAC,aAAa,CAAC,MAAc,EAAE,IAA2B,EAAE,gBAA2B;QAC3F,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACnI,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC,wDAAwD;QACnF,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACnD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,8GAA8G;IAC9G,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,8FAA8F;QAC9F,4EAA4E;QAC5E,MAAM,KAAK,GAAG,6BAA6B,CAAC;QAC5C,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAEnD,OAAO,aAAa,CAAC;IACvB,CAAC;CAEF"}
|
package/package.json
CHANGED
|
@@ -13,27 +13,13 @@ export class SlugHelper {
|
|
|
13
13
|
return verfiedSlug;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
//remove
|
|
16
|
+
//remove long sequences of single-digit numbers (e.g., 1-2-3-4 becomes 1), but preserve normal number patterns
|
|
17
17
|
static numerifySlug(slug: string) {
|
|
18
18
|
let initialString = slug;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
matchedArray.forEach((data) => {
|
|
24
|
-
const length = data.length;
|
|
25
|
-
let splitResult = data;
|
|
26
|
-
if (data.includes("-")) {
|
|
27
|
-
splitResult = data.split("-")[0];
|
|
28
|
-
} else if (length > 2) {
|
|
29
|
-
splitResult = data.substring(0, 2);
|
|
30
|
-
}
|
|
31
|
-
if (splitResult !== data) {
|
|
32
|
-
const replacedString = initialString.replace(data, splitResult);
|
|
33
|
-
initialString = replacedString;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
19
|
+
// Only match sequences of 3+ single-digit numbers separated by hyphens (e.g., 1-2-3, 1-2-3-4)
|
|
20
|
+
// This avoids mangling things like chapter-verse references (6-11) or dates
|
|
21
|
+
const regex = /\b(\d)-(\d)-(\d)(?:-\d)*\b/g;
|
|
22
|
+
initialString = initialString.replace(regex, "$1");
|
|
37
23
|
|
|
38
24
|
return initialString;
|
|
39
25
|
}
|