(str)
| 197 | } |
| 198 | |
| 199 | function decodeHtmlEntities(str) { |
| 200 | if (!str) return ""; |
| 201 | try { |
| 202 | const input = String(str); |
| 203 | return input.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (match, code) => { |
| 204 | if (!code) return match; |
| 205 | if (code[0] === '#') { |
| 206 | const isHex = code[1] === 'x' || code[1] === 'X'; |
| 207 | const num = isHex ? parseInt(code.slice(2), 16) : parseInt(code.slice(1), 10); |
| 208 | if (!Number.isFinite(num)) return match; |
| 209 | try { return String.fromCodePoint(num); } catch (e) { return match; } |
| 210 | } |
| 211 | const table = { |
| 212 | amp: '&', |
| 213 | lt: '<', |
| 214 | gt: '>', |
| 215 | quot: '"', |
| 216 | apos: "'", |
| 217 | nbsp: '\u00A0', |
| 218 | colon: ':', |
| 219 | slash: '/', |
| 220 | backslash: '\\' |
| 221 | }; |
| 222 | const lower = code.toLowerCase(); |
| 223 | return Object.prototype.hasOwnProperty.call(table, lower) ? table[lower] : match; |
| 224 | }); |
| 225 | } catch (e) { |
| 226 | return String(str); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | function compareSemverLite(a, b) { |
| 231 | const pa = String(a || '').split('.').map(n => parseInt(n, 10) || 0); |
no outgoing calls
no test coverage detected