@smartsoft001/auth-shell-dtos 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
|
@@ -133,6 +133,31 @@ var ObjectService = class {
|
|
|
133
133
|
// packages/shared/utils/src/lib/services/password/password.service.ts
|
|
134
134
|
import md5 from "md5";
|
|
135
135
|
|
|
136
|
+
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
137
|
+
var RemoveHtmlService = class {
|
|
138
|
+
/**
|
|
139
|
+
* Remove HTML tags and decode HTML entities from text
|
|
140
|
+
* - Removes HTML tags
|
|
141
|
+
* - Decodes common named entities ( , ", etc.)
|
|
142
|
+
* - Decodes numeric entities ({ or «)
|
|
143
|
+
* - Removes any remaining unrecognized entities
|
|
144
|
+
*/
|
|
145
|
+
static create(val) {
|
|
146
|
+
if (!val) {
|
|
147
|
+
return "";
|
|
148
|
+
}
|
|
149
|
+
let result = val;
|
|
150
|
+
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
151
|
+
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, "");
|
|
152
|
+
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
153
|
+
/&#x([0-9a-f]+);/gi,
|
|
154
|
+
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
155
|
+
);
|
|
156
|
+
result = result.replace(/&[a-z]+;/gi, "");
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
136
161
|
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
137
162
|
var SlugService = class _SlugService {
|
|
138
163
|
static {
|
|
@@ -159,6 +184,7 @@ var SlugService = class _SlugService {
|
|
|
159
184
|
}
|
|
160
185
|
/**
|
|
161
186
|
* Convert text to URL-friendly slug
|
|
187
|
+
* - Removes HTML tags and entities
|
|
162
188
|
* - Replaces Polish characters with English equivalents
|
|
163
189
|
* - Converts to lowercase
|
|
164
190
|
* - Replaces spaces and special characters with hyphens
|
|
@@ -169,7 +195,8 @@ var SlugService = class _SlugService {
|
|
|
169
195
|
if (!text) {
|
|
170
196
|
return "";
|
|
171
197
|
}
|
|
172
|
-
let slug =
|
|
198
|
+
let slug = RemoveHtmlService.create(text);
|
|
199
|
+
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
173
200
|
slug = slug.toLowerCase();
|
|
174
201
|
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
175
202
|
slug = slug.replace(/-+/g, "-");
|
package/package.json
CHANGED