@smartsoft001/trans-shell-nestjs 2.105.0 → 2.107.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.
Files changed (2) hide show
  1. package/index.js +28 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -125,6 +125,31 @@ var PasswordService = class _PasswordService {
125
125
  }
126
126
  };
127
127
 
128
+ // packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
129
+ var RemoveHtmlService = class {
130
+ /**
131
+ * Remove HTML tags and decode HTML entities from text
132
+ * - Removes HTML tags
133
+ * - Decodes common named entities ( , ", etc.)
134
+ * - Decodes numeric entities ({ or «)
135
+ * - Removes any remaining unrecognized entities
136
+ */
137
+ static create(val) {
138
+ if (!val) {
139
+ return "";
140
+ }
141
+ let result = val;
142
+ result = result.replace(/<[^>]*(>|$)/g, "");
143
+ result = result.replace(/&nbsp;/g, " ").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&bdquo;/g, "\u201E").replace(/&rdquo;/g, '"').replace(/&ldquo;/g, '"').replace(/&laquo;/g, "\xAB").replace(/&raquo;/g, "\xBB").replace(/&zwnj;/g, "");
144
+ result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
145
+ /&#x([0-9a-f]+);/gi,
146
+ (match, hex) => String.fromCharCode(parseInt(hex, 16))
147
+ );
148
+ result = result.replace(/&[a-z]+;/gi, "");
149
+ return result;
150
+ }
151
+ };
152
+
128
153
  // packages/shared/utils/src/lib/services/slug/slug.service.ts
129
154
  var SlugService = class _SlugService {
130
155
  static {
@@ -151,6 +176,7 @@ var SlugService = class _SlugService {
151
176
  }
152
177
  /**
153
178
  * Convert text to URL-friendly slug
179
+ * - Removes HTML tags and entities
154
180
  * - Replaces Polish characters with English equivalents
155
181
  * - Converts to lowercase
156
182
  * - Replaces spaces and special characters with hyphens
@@ -161,7 +187,8 @@ var SlugService = class _SlugService {
161
187
  if (!text) {
162
188
  return "";
163
189
  }
164
- let slug = text.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
190
+ let slug = RemoveHtmlService.create(text);
191
+ slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
165
192
  slug = slug.toLowerCase();
166
193
  slug = slug.replace(/[^a-z0-9]+/g, "-");
167
194
  slug = slug.replace(/-+/g, "-");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/trans-shell-nestjs",
3
- "version": "2.105.0",
3
+ "version": "2.107.0",
4
4
  "description": "This library was generated with [Nx](https://nx.dev).",
5
5
  "repository": {
6
6
  "type": "git",