@churchapps/apphelper 0.5.9 → 0.5.10

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;CAqBjC"}
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;CAwBjC"}
@@ -10,7 +10,7 @@ export class SlugHelper {
10
10
  const verfiedSlug = this.numerifySlug(initialSlug);
11
11
  return verfiedSlug;
12
12
  }
13
- //remove multiple numbers in sequence
13
+ //remove multiple numbers in sequence (e.g., 1-2-3 becomes 1), but allow standalone 1-2 digit numbers
14
14
  static numerifySlug(slug) {
15
15
  let initialString = slug;
16
16
  const regex = /\d+(?:-\d+)+|\d+/g;
@@ -19,12 +19,16 @@ export class SlugHelper {
19
19
  matchedArray.forEach((data) => {
20
20
  const length = data.length;
21
21
  let splitResult = data;
22
- if (length > 1) {
23
- const array = data.split("");
24
- splitResult = array[0];
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;
25
31
  }
26
- const replacedString = initialString.replace(data, splitResult);
27
- initialString = replacedString;
28
32
  });
29
33
  }
30
34
  return initialString;
@@ -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,qCAAqC;IACrC,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAClC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,OAA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I,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACnD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,qGAAqG;IACrG,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,IAAI,aAAa,GAAG,IAAI,CAAC;QACzB,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAClC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhD,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC3B,IAAI,WAAW,GAAG,IAAI,CAAC;gBACvB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvB,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnC,CAAC;qBAAM,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtB,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACrC,CAAC;gBACD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;oBACzB,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;oBAChE,aAAa,GAAG,cAAc,CAAC;gBACjC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CAEF"}
@@ -157,6 +157,7 @@
157
157
  "forgot": "Forgot Password",
158
158
  "goLogin": "Go to Login",
159
159
  "login": "Login",
160
+ "noAcc": "Don't have an account?",
160
161
  "password": "Password",
161
162
  "register": "Register",
162
163
  "registerThankYou": "Thank you for registering! Please check your email to verify your account.",
@@ -155,6 +155,7 @@
155
155
  "forgot": "Olvidó la Contraseña",
156
156
  "goLogin": "Ir a Iniciar Sesión",
157
157
  "login": "Iniciar Sesión",
158
+ "noAcc": "¿No tiene una cuenta?",
158
159
  "password": "Contraseña",
159
160
  "register": "Registrarse",
160
161
  "registerThankYou": "¡Gracias por registrarse! Por favor revise su correo electrónico para verificar su cuenta.",
@@ -258,7 +259,9 @@
258
259
  "chatWith": "Chatear con",
259
260
  "deleteChurch": "Eliminar iglesia de la lista",
260
261
  "logout": "Cerrar sesión",
262
+ "messages": "Mensajes",
261
263
  "newPrivateMessage": "Nuevo Mensaje Privado",
264
+ "notifications": "Notificaciones",
262
265
  "privateMessage": "Mensaje Privado",
263
266
  "profile": "Perfil",
264
267
  "searchForPerson": "Buscar a una persona",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchapps/apphelper",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
4
4
  "description": "Library of helper functions for React and NextJS ChurchApps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -157,6 +157,7 @@
157
157
  "forgot": "Forgot Password",
158
158
  "goLogin": "Go to Login",
159
159
  "login": "Login",
160
+ "noAcc": "Don't have an account?",
160
161
  "password": "Password",
161
162
  "register": "Register",
162
163
  "registerThankYou": "Thank you for registering! Please check your email to verify your account.",
@@ -155,6 +155,7 @@
155
155
  "forgot": "Olvidó la Contraseña",
156
156
  "goLogin": "Ir a Iniciar Sesión",
157
157
  "login": "Iniciar Sesión",
158
+ "noAcc": "¿No tiene una cuenta?",
158
159
  "password": "Contraseña",
159
160
  "register": "Registrarse",
160
161
  "registerThankYou": "¡Gracias por registrarse! Por favor revise su correo electrónico para verificar su cuenta.",
@@ -258,7 +259,9 @@
258
259
  "chatWith": "Chatear con",
259
260
  "deleteChurch": "Eliminar iglesia de la lista",
260
261
  "logout": "Cerrar sesión",
262
+ "messages": "Mensajes",
261
263
  "newPrivateMessage": "Nuevo Mensaje Privado",
264
+ "notifications": "Notificaciones",
262
265
  "privateMessage": "Mensaje Privado",
263
266
  "profile": "Perfil",
264
267
  "searchForPerson": "Buscar a una persona",
@@ -13,7 +13,7 @@ export class SlugHelper {
13
13
  return verfiedSlug;
14
14
  }
15
15
 
16
- //remove multiple numbers in sequence
16
+ //remove multiple numbers in sequence (e.g., 1-2-3 becomes 1), but allow standalone 1-2 digit numbers
17
17
  static numerifySlug(slug: string) {
18
18
  let initialString = slug;
19
19
  const regex = /\d+(?:-\d+)+|\d+/g;
@@ -23,15 +23,18 @@ export class SlugHelper {
23
23
  matchedArray.forEach((data) => {
24
24
  const length = data.length;
25
25
  let splitResult = data;
26
- if (length > 1) {
27
- const array = data.split("");
28
- splitResult = array[0];
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;
29
34
  }
30
- const replacedString = initialString.replace(data, splitResult);
31
- initialString = replacedString;
32
35
  });
33
36
  }
34
-
37
+
35
38
  return initialString;
36
39
  }
37
40