@smartsoft001/utils 2.100.0 → 2.102.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 +1 -1
- package/src/lib/services/index.d.ts +5 -4
- package/src/lib/services/index.js +5 -4
- package/src/lib/services/index.js.map +1 -1
- package/src/lib/services/slug/slug.service.d.ts +12 -0
- package/src/lib/services/slug/slug.service.js +51 -0
- package/src/lib/services/slug/slug.service.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * from './
|
|
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 './
|
|
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 './
|
|
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("./
|
|
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("./
|
|
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("./
|
|
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,
|
|
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): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.split('').map(char => SlugService.polishToEnglishMap[char] || char).join('');
|
|
19
|
+
// Convert to lowercase
|
|
20
|
+
slug = slug.toLowerCase();
|
|
21
|
+
// Replace spaces and special characters with hyphens
|
|
22
|
+
slug = slug.replace(/[^a-z0-9]+/g, '-');
|
|
23
|
+
// Remove multiple consecutive hyphens
|
|
24
|
+
slug = slug.replace(/-+/g, '-');
|
|
25
|
+
// Trim hyphens from start and end
|
|
26
|
+
slug = slug.replace(/^-+|-+$/g, '');
|
|
27
|
+
return slug;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.SlugService = SlugService;
|
|
31
|
+
SlugService.polishToEnglishMap = {
|
|
32
|
+
'ą': 'a',
|
|
33
|
+
'ć': 'c',
|
|
34
|
+
'ę': 'e',
|
|
35
|
+
'ł': 'l',
|
|
36
|
+
'ń': 'n',
|
|
37
|
+
'ó': 'o',
|
|
38
|
+
'ś': 's',
|
|
39
|
+
'ź': 'z',
|
|
40
|
+
'ż': 'z',
|
|
41
|
+
'Ą': 'A',
|
|
42
|
+
'Ć': 'C',
|
|
43
|
+
'Ę': 'E',
|
|
44
|
+
'Ł': 'L',
|
|
45
|
+
'Ń': 'N',
|
|
46
|
+
'Ó': 'O',
|
|
47
|
+
'Ś': 'S',
|
|
48
|
+
'Ź': 'Z',
|
|
49
|
+
'Ż': 'Z'
|
|
50
|
+
};
|
|
51
|
+
//# 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,IAAY;QACxB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,C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