@excofy/utils 2.3.2 → 2.3.3

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/dist/index.cjs CHANGED
@@ -155,6 +155,9 @@ function sanitizeValue(value, allowedTags) {
155
155
  return filter.process(value);
156
156
  }
157
157
  function htmlEntityDecode(str = "") {
158
+ if (!str || typeof str !== "string" || str.length === 0) {
159
+ return "";
160
+ }
158
161
  return str.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(code)).replace(
159
162
  /&#x([0-9a-f]+);/gi,
160
163
  (_, code) => String.fromCharCode(Number.parseInt(code, 16))
package/dist/index.js CHANGED
@@ -117,6 +117,9 @@ function sanitizeValue(value, allowedTags) {
117
117
  return filter.process(value);
118
118
  }
119
119
  function htmlEntityDecode(str = "") {
120
+ if (!str || typeof str !== "string" || str.length === 0) {
121
+ return "";
122
+ }
120
123
  return str.replace(/&#(\d+);/g, (_, code) => String.fromCharCode(code)).replace(
121
124
  /&#x([0-9a-f]+);/gi,
122
125
  (_, code) => String.fromCharCode(Number.parseInt(code, 16))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excofy/utils",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Biblioteca de utilitários para o Excofy",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -102,6 +102,10 @@ export function sanitizeValue(
102
102
  }
103
103
 
104
104
  export function htmlEntityDecode(str = ''): string {
105
+ if (!str || typeof str !== 'string' || str.length === 0) {
106
+ return '';
107
+ }
108
+
105
109
  return str
106
110
  .replace(/&#(\d+);/g, (_, code) => String.fromCharCode(code))
107
111
  .replace(/&#x([0-9a-f]+);/gi, (_, code) =>