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

Function readAttributes

apps/sim/tools/workday/soap.ts:360–386  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

358 }
359
360 function readAttributes(): Record<string, string> {
361 const attrs: Record<string, string> = {}
362 while (i < len) {
363 skipWhitespace()
364 const c = xml[i]
365 if (c === '>' || c === '/' || c === '?') return attrs
366 const name = readName()
367 skipWhitespace()
368 if (xml[i] !== '=') {
369 attrs[name] = ''
370 continue
371 }
372 i++ // =
373 skipWhitespace()
374 const quote = xml[i]
375 if (quote !== '"' && quote !== "'") {
376 attrs[name] = ''
377 continue
378 }
379 i++
380 const start = i
381 while (i < len && xml[i] !== quote) i++
382 attrs[name] = decodeEntities(xml.slice(start, i))
383 if (i < len) i++ // closing quote
384 }
385 return attrs
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) => {

Callers 1

parseNodeFunction · 0.85

Calls 3

skipWhitespaceFunction · 0.85
readNameFunction · 0.85
decodeEntitiesFunction · 0.85

Tested by

no test coverage detected