@smartsoft001/auth-shell-nestjs 2.107.0 → 2.108.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/index.js +28 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -118,6 +118,31 @@ var PasswordService = class _PasswordService {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
122
|
+
var RemoveHtmlService = class {
|
|
123
|
+
/**
|
|
124
|
+
* Remove HTML tags and decode HTML entities from text
|
|
125
|
+
* - Removes HTML tags
|
|
126
|
+
* - Decodes common named entities ( , ", etc.)
|
|
127
|
+
* - Decodes numeric entities ({ or «)
|
|
128
|
+
* - Removes any remaining unrecognized entities
|
|
129
|
+
*/
|
|
130
|
+
static create(val) {
|
|
131
|
+
if (!val) {
|
|
132
|
+
return "";
|
|
133
|
+
}
|
|
134
|
+
let result = val;
|
|
135
|
+
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
136
|
+
result = result.replace(/ /g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/„/g, "\u201E").replace(/”/g, '"').replace(/“/g, '"').replace(/«/g, "\xAB").replace(/»/g, "\xBB").replace(/‌/g, "");
|
|
137
|
+
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
138
|
+
/&#x([0-9a-f]+);/gi,
|
|
139
|
+
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
140
|
+
);
|
|
141
|
+
result = result.replace(/&[a-z]+;/gi, "");
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
121
146
|
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
122
147
|
var SlugService = class _SlugService {
|
|
123
148
|
static {
|
|
@@ -144,6 +169,7 @@ var SlugService = class _SlugService {
|
|
|
144
169
|
}
|
|
145
170
|
/**
|
|
146
171
|
* Convert text to URL-friendly slug
|
|
172
|
+
* - Removes HTML tags and entities
|
|
147
173
|
* - Replaces Polish characters with English equivalents
|
|
148
174
|
* - Converts to lowercase
|
|
149
175
|
* - Replaces spaces and special characters with hyphens
|
|
@@ -154,7 +180,8 @@ var SlugService = class _SlugService {
|
|
|
154
180
|
if (!text) {
|
|
155
181
|
return "";
|
|
156
182
|
}
|
|
157
|
-
let slug =
|
|
183
|
+
let slug = RemoveHtmlService.create(text);
|
|
184
|
+
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
158
185
|
slug = slug.toLowerCase();
|
|
159
186
|
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
160
187
|
slug = slug.replace(/-+/g, "-");
|