(value: string)
| 322 | } |
| 323 | |
| 324 | function decodeXmlEntities(value: string): string { |
| 325 | return value.replace( |
| 326 | /&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g, |
| 327 | (entity, body: string) => { |
| 328 | switch (body) { |
| 329 | case 'amp': |
| 330 | return '&'; |
| 331 | case 'lt': |
| 332 | return '<'; |
| 333 | case 'gt': |
| 334 | return '>'; |
| 335 | case 'quot': |
| 336 | return '"'; |
| 337 | case 'apos': |
| 338 | return "'"; |
| 339 | default: |
| 340 | return decodeNumericXmlEntity(entity, body); |
| 341 | } |
| 342 | }, |
| 343 | ); |
| 344 | } |
| 345 | |
| 346 | function decodeNumericXmlEntity(entity: string, body: string): string { |
| 347 | const codePoint = body.startsWith('#x') |
no test coverage detected