MCPcopy Create free account
hub / github.com/denoland/std / parseName

Function parseName

xml/_parser_test.ts:32–46  ·  view source on GitHub ↗

Parses a qualified name string into an XmlName object.

(
  raw: string,
  colonIndex: number,
  uri?: string,
)

Source from the content-addressed store, hash-verified

30
31/** Parses a qualified name string into an XmlName object. */
32function parseName(
33 raw: string,
34 colonIndex: number,
35 uri?: string,
36): XmlName {
37 if (colonIndex === -1) {
38 return { raw, local: raw };
39 }
40 return {
41 raw,
42 local: raw.slice(colonIndex + 1),
43 prefix: raw.slice(0, colonIndex),
44 ...(uri !== undefined && { uri }),
45 };
46}
47
48/** Creates callbacks that collect events into an array. */
49function createEventCollector(): {

Callers 2

onStartElementFunction · 0.70
onEndElementFunction · 0.70

Calls 1

sliceMethod · 0.45

Tested by

no test coverage detected