@smartsoft001/utils 2.106.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/utils",
3
- "version": "2.106.0",
3
+ "version": "2.108.0",
4
4
  "dependencies": {
5
5
  "guid-typescript": "^1.0.9",
6
6
  "md5": "^2.3.0",
@@ -4,6 +4,7 @@ export * from './nip/nip.service';
4
4
  export * from './object/object.service';
5
5
  export * from './password/password.service';
6
6
  export * from './pesel/pesel.service';
7
+ export * from './remove-html/remove-html.service';
7
8
  export * from './slug/slug.service';
8
9
  export * from './specification/specification.service';
9
10
  export * from './zip-code/zip-code.service';
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./nip/nip.service"), exports);
7
7
  tslib_1.__exportStar(require("./object/object.service"), exports);
8
8
  tslib_1.__exportStar(require("./password/password.service"), exports);
9
9
  tslib_1.__exportStar(require("./pesel/pesel.service"), exports);
10
+ tslib_1.__exportStar(require("./remove-html/remove-html.service"), exports);
10
11
  tslib_1.__exportStar(require("./slug/slug.service"), exports);
11
12
  tslib_1.__exportStar(require("./specification/specification.service"), exports);
12
13
  tslib_1.__exportStar(require("./zip-code/zip-code.service"), exports);
@@ -1 +1 @@
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;AAC5C,gEAAsC"}
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,4EAAkD;AAClD,8DAAoC;AACpC,gFAAsD;AACtD,sEAA4C;AAC5C,gEAAsC"}
@@ -0,0 +1,10 @@
1
+ export declare class RemoveHtmlService {
2
+ /**
3
+ * Remove HTML tags and decode HTML entities from text
4
+ * - Removes HTML tags
5
+ * - Decodes common named entities ( , ", etc.)
6
+ * - Decodes numeric entities ({ or «)
7
+ * - Removes any remaining unrecognized entities
8
+ */
9
+ static create(val: string | undefined | null): string;
10
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoveHtmlService = void 0;
4
+ class RemoveHtmlService {
5
+ /**
6
+ * Remove HTML tags and decode HTML entities from text
7
+ * - Removes HTML tags
8
+ * - Decodes common named entities ( , ", etc.)
9
+ * - Decodes numeric entities ({ or «)
10
+ * - Removes any remaining unrecognized entities
11
+ */
12
+ static create(val) {
13
+ if (!val) {
14
+ return '';
15
+ }
16
+ let result = val;
17
+ // Remove HTML tags
18
+ result = result.replace(/<[^>]*(>|$)/g, '');
19
+ // Decode common named entities
20
+ result = result
21
+ .replace(/&nbsp;/g, ' ')
22
+ .replace(/&quot;/g, '"')
23
+ .replace(/&apos;/g, "'")
24
+ .replace(/&lt;/g, '<')
25
+ .replace(/&gt;/g, '>')
26
+ .replace(/&amp;/g, '&')
27
+ .replace(/&bdquo;/g, '„')
28
+ .replace(/&rdquo;/g, '"')
29
+ .replace(/&ldquo;/g, '"')
30
+ .replace(/&laquo;/g, '«')
31
+ .replace(/&raquo;/g, '»')
32
+ .replace(/&zwnj;/g, '');
33
+ // Decode numeric entities (&#123; or &#xAB;)
34
+ result = result
35
+ .replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec))
36
+ .replace(/&#x([0-9a-f]+);/gi, (match, hex) => String.fromCharCode(parseInt(hex, 16)));
37
+ // Remove any remaining unrecognized entities
38
+ result = result.replace(/&[a-z]+;/gi, '');
39
+ return result;
40
+ }
41
+ }
42
+ exports.RemoveHtmlService = RemoveHtmlService;
43
+ //# sourceMappingURL=remove-html.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-html.service.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,GAA8B;QAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,MAAM,GAAG,GAAG,CAAC;QAEjB,mBAAmB;QACnB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAE5C,+BAA+B;QAC/B,MAAM,GAAG,MAAM;aACZ,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;aACvB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;aACvB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;aACvB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;aACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;aACrB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;aACtB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;aACxB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAE1B,6CAA6C;QAC7C,MAAM,GAAG,MAAM;aACZ,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aAC9D,OAAO,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAC3C,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CACvC,CAAC;QAEJ,6CAA6C;QAC7C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAE1C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA7CD,8CA6CC"}
@@ -2,6 +2,7 @@ export declare class SlugService {
2
2
  private static readonly polishToEnglishMap;
3
3
  /**
4
4
  * Convert text to URL-friendly slug
5
+ * - Removes HTML tags and entities
5
6
  * - Replaces Polish characters with English equivalents
6
7
  * - Converts to lowercase
7
8
  * - Replaces spaces and special characters with hyphens
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SlugService = void 0;
4
+ const remove_html_service_1 = require("../remove-html/remove-html.service");
4
5
  class SlugService {
5
6
  /**
6
7
  * Convert text to URL-friendly slug
8
+ * - Removes HTML tags and entities
7
9
  * - Replaces Polish characters with English equivalents
8
10
  * - Converts to lowercase
9
11
  * - Replaces spaces and special characters with hyphens
@@ -14,8 +16,10 @@ class SlugService {
14
16
  if (!text) {
15
17
  return '';
16
18
  }
19
+ // Remove HTML tags and decode HTML entities
20
+ let slug = remove_html_service_1.RemoveHtmlService.create(text);
17
21
  // Replace Polish characters with English equivalents
18
- let slug = text
22
+ slug = slug
19
23
  .split('')
20
24
  .map((char) => SlugService.polishToEnglishMap[char] || char)
21
25
  .join('');
@@ -1 +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,IAA+B;QAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,qDAAqD;QACrD,IAAI,IAAI,GAAG,IAAI;aACZ,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;aAC3D,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,uBAAuB;QACvB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAE1B,qDAAqD;QACrD,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAExC,sCAAsC;QACtC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEhC,kCAAkC;QAClC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC;IACd,CAAC;;AAtDH,kCAuDC;AAtDyB,8BAAkB,GAA2B;IACnE,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;CACP,CAAC"}
1
+ {"version":3,"file":"slug.service.js","sourceRoot":"","sources":["../../../../../../../../packages/shared/utils/src/lib/services/slug/slug.service.ts"],"names":[],"mappings":";;;AAAA,4EAAuE;AAEvE,MAAa,WAAW;IAsBtB;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,IAA+B;QAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,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