MCPcopy
hub / github.com/vuejs/core / serializeElement

Function serializeElement

packages/runtime-test/src/serialize.ts:35–57  ·  view source on GitHub ↗
(
  node: TestElement,
  indent: number,
  depth: number,
)

Source from the content-addressed store, hash-verified

33}
34
35function serializeElement(
36 node: TestElement,
37 indent: number,
38 depth: number,
39): string {
40 const props = Object.keys(node.props)
41 .map(key => {
42 const value = node.props[key]
43 return isOn(key) || value == null
44 ? ``
45 : value === ``
46 ? key
47 : `${key}=${JSON.stringify(value)}`
48 })
49 .filter(Boolean)
50 .join(' ')
51 const padding = indent ? ` `.repeat(indent).repeat(depth) : ``
52 return (
53 `${padding}<${node.tag}${props ? ` ${props}` : ``}>` +
54 `${serializeInner(node, indent, depth)}` +
55 `${padding}</${node.tag}>`
56 )
57}
58
59function serializeText(
60 node: TestText | TestComment,

Callers 1

serializeFunction · 0.85

Calls 4

isOnFunction · 0.90
serializeInnerFunction · 0.85
mapMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected