MCPcopy Index your code
hub / github.com/simstudioai/sim / decodeEntities

Function decodeEntities

apps/sim/tools/workday/soap.ts:388–407  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

386 }
387
388 function decodeEntities(s: string): string {
389 return s.replace(/&(amp|lt|gt|quot|apos|#\d+|#x[0-9a-fA-F]+);/g, (_, ent) => {
390 switch (ent) {
391 case 'amp':
392 return '&'
393 case 'lt':
394 return '<'
395 case 'gt':
396 return '>'
397 case 'quot':
398 return '"'
399 case 'apos':
400 return "'"
401 default:
402 if (ent.startsWith('#x')) return String.fromCodePoint(Number.parseInt(ent.slice(2), 16))
403 if (ent.startsWith('#')) return String.fromCodePoint(Number.parseInt(ent.slice(1), 10))
404 return `&${ent};`
405 }
406 })
407 }
408
409 function localOf(name: string): string {
410 const idx = name.indexOf(':')

Callers 2

readAttributesFunction · 0.85
parseNodeFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected