@smartsoft001/utils 2.101.0 → 2.103.0

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": "@smartsoft001/utils",
3
- "version": "2.101.0",
3
+ "version": "2.103.0",
4
4
  "dependencies": {
5
5
  "guid-typescript": "^1.0.9",
6
6
  "md5": "^2.3.0",
@@ -1,8 +1,9 @@
1
- export * from './password/password.service';
1
+ export * from './array/array.service';
2
+ export * from './guid/guid.service';
2
3
  export * from './nip/nip.service';
3
- export * from './zip-code/zip-code.service';
4
4
  export * from './object/object.service';
5
- export * from './guid/guid.service';
5
+ export * from './password/password.service';
6
6
  export * from './pesel/pesel.service';
7
+ export * from './slug/slug.service';
7
8
  export * from './specification/specification.service';
8
- export * from './array/array.service';
9
+ export * from './zip-code/zip-code.service';
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./password/password.service"), exports);
4
+ tslib_1.__exportStar(require("./array/array.service"), exports);
5
+ tslib_1.__exportStar(require("./guid/guid.service"), exports);
5
6
  tslib_1.__exportStar(require("./nip/nip.service"), exports);
6
- tslib_1.__exportStar(require("./zip-code/zip-code.service"), exports);
7
7
  tslib_1.__exportStar(require("./object/object.service"), exports);
8
- tslib_1.__exportStar(require("./guid/guid.service"), exports);
8
+ tslib_1.__exportStar(require("./password/password.service"), exports);
9
9
  tslib_1.__exportStar(require("./pesel/pesel.service"), exports);
10
+ tslib_1.__exportStar(require("./slug/slug.service"), exports);
10
11
  tslib_1.__exportStar(require("./specification/specification.service"), exports);
11
- tslib_1.__exportStar(require("./array/array.service"), exports);
12
+ tslib_1.__exportStar(require("./zip-code/zip-code.service"), exports);
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/shared/utils/src/lib/services/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,4DAAkC;AAClC,sEAA4C;AAC5C,kEAAwC;AACxC,8DAAoC;AACpC,gEAAsC;AACtC,gFAAsD;AACtD,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/shared/utils/src/lib/services/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,8DAAoC;AACpC,4DAAkC;AAClC,kEAAwC;AACxC,sEAA4C;AAC5C,gEAAsC;AACtC,8DAAoC;AACpC,gFAAsD;AACtD,sEAA4C"}
@@ -0,0 +1,12 @@
1
+ export declare class SlugService {
2
+ private static readonly polishToEnglishMap;
3
+ /**
4
+ * Convert text to URL-friendly slug
5
+ * - Replaces Polish characters with English equivalents
6
+ * - Converts to lowercase
7
+ * - Replaces spaces and special characters with hyphens
8
+ * - Removes multiple consecutive hyphens
9
+ * - Trims hyphens from start and end
10
+ */
11
+ static create(text: string | undefined | null): string;
12
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlugService = void 0;
4
+ class SlugService {
5
+ /**
6
+ * Convert text to URL-friendly slug
7
+ * - Replaces Polish characters with English equivalents
8
+ * - Converts to lowercase
9
+ * - Replaces spaces and special characters with hyphens
10
+ * - Removes multiple consecutive hyphens
11
+ * - Trims hyphens from start and end
12
+ */
13
+ static create(text) {
14
+ if (!text) {
15
+ return '';
16
+ }
17
+ // Replace Polish characters with English equivalents
18
+ let slug = text
19
+ .split('')
20
+ .map((char) => SlugService.polishToEnglishMap[char] || char)
21
+ .join('');
22
+ // Convert to lowercase
23
+ slug = slug.toLowerCase();
24
+ // Replace spaces and special characters with hyphens
25
+ slug = slug.replace(/[^a-z0-9]+/g, '-');
26
+ // Remove multiple consecutive hyphens
27
+ slug = slug.replace(/-+/g, '-');
28
+ // Trim hyphens from start and end
29
+ slug = slug.replace(/^-+|-+$/g, '');
30
+ return slug;
31
+ }
32
+ }
33
+ exports.SlugService = SlugService;
34
+ SlugService.polishToEnglishMap = {
35
+ ą: 'a',
36
+ ć: 'c',
37
+ ę: 'e',
38
+ ł: 'l',
39
+ ń: 'n',
40
+ ó: 'o',
41
+ ś: 's',
42
+ ź: 'z',
43
+ ż: 'z',
44
+ Ą: 'A',
45
+ Ć: 'C',
46
+ Ę: 'E',
47
+ Ł: 'L',
48
+ Ń: 'N',
49
+ Ó: 'O',
50
+ Ś: 'S',
51
+ Ź: 'Z',
52
+ Ż: 'Z',
53
+ };
54
+ //# sourceMappingURL=slug.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slug.service.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/utils/src/lib/services/slug/slug.service.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAsBtB;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,IAA+B;QAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,qDAAqD;QACrD,IAAI,IAAI,GAAG,IAAI;aACZ,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;aAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,uBAAuB;QACvB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1B,qDAAqD;QACrD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAExC,sCAAsC;QACtC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEhC,kCAAkC;QAClC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC;IACd,CAAC;;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