@smartsoft001/mongo 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.cjs +28 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -114,6 +114,31 @@ var ObjectService = class {
|
|
|
114
114
|
// packages/shared/utils/src/lib/services/password/password.service.ts
|
|
115
115
|
var import_md5 = __toESM(require("md5"));
|
|
116
116
|
|
|
117
|
+
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
118
|
+
var RemoveHtmlService = class {
|
|
119
|
+
/**
|
|
120
|
+
* Remove HTML tags and decode HTML entities from text
|
|
121
|
+
* - Removes HTML tags
|
|
122
|
+
* - Decodes common named entities ( , ", etc.)
|
|
123
|
+
* - Decodes numeric entities ({ or «)
|
|
124
|
+
* - Removes any remaining unrecognized entities
|
|
125
|
+
*/
|
|
126
|
+
static create(val) {
|
|
127
|
+
if (!val) {
|
|
128
|
+
return "";
|
|
129
|
+
}
|
|
130
|
+
let result = val;
|
|
131
|
+
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
132
|
+
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, "");
|
|
133
|
+
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
134
|
+
/&#x([0-9a-f]+);/gi,
|
|
135
|
+
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
136
|
+
);
|
|
137
|
+
result = result.replace(/&[a-z]+;/gi, "");
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
117
142
|
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
118
143
|
var SlugService = class _SlugService {
|
|
119
144
|
static {
|
|
@@ -140,6 +165,7 @@ var SlugService = class _SlugService {
|
|
|
140
165
|
}
|
|
141
166
|
/**
|
|
142
167
|
* Convert text to URL-friendly slug
|
|
168
|
+
* - Removes HTML tags and entities
|
|
143
169
|
* - Replaces Polish characters with English equivalents
|
|
144
170
|
* - Converts to lowercase
|
|
145
171
|
* - Replaces spaces and special characters with hyphens
|
|
@@ -150,7 +176,8 @@ var SlugService = class _SlugService {
|
|
|
150
176
|
if (!text) {
|
|
151
177
|
return "";
|
|
152
178
|
}
|
|
153
|
-
let slug =
|
|
179
|
+
let slug = RemoveHtmlService.create(text);
|
|
180
|
+
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
154
181
|
slug = slug.toLowerCase();
|
|
155
182
|
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
156
183
|
slug = slug.replace(/-+/g, "-");
|