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

Function header

packages/runtime-core/src/customFormatter.ts:30–71  ·  view source on GitHub ↗
(obj: unknown)

Source from the content-addressed store, hash-verified

28 const formatter = {
29 __vue_custom_formatter: true,
30 header(obj: unknown) {
31 // TODO also format ComponentPublicInstance & ctx.slots/attrs in setup
32 if (!isObject(obj)) {
33 return null
34 }
35
36 if (obj.__isVue) {
37 return ['div', vueStyle, `VueInstance`]
38 } else if (isRef(obj)) {
39 // avoid tracking during debugger accessing
40 pauseTracking()
41 const value = obj.value
42 resetTracking()
43 return [
44 'div',
45 {},
46 ['span', vueStyle, genRefFlag(obj)],
47 '<',
48 formatValue(value),
49 `>`,
50 ]
51 } else if (isReactive(obj)) {
52 return [
53 'div',
54 {},
55 ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
56 '<',
57 formatValue(obj),
58 `>${isReadonly(obj) ? ` (readonly)` : ``}`,
59 ]
60 } else if (isReadonly(obj)) {
61 return [
62 'div',
63 {},
64 ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
65 '<',
66 formatValue(obj),
67 '>',
68 ]
69 }
70 return null
71 },
72 hasBody(obj: unknown) {
73 return obj && (obj as any).__isVue
74 },

Callers

nothing calls this directly

Calls 9

isObjectFunction · 0.90
isRefFunction · 0.90
pauseTrackingFunction · 0.90
resetTrackingFunction · 0.90
isReactiveFunction · 0.90
isShallowFunction · 0.90
isReadonlyFunction · 0.90
genRefFlagFunction · 0.85
formatValueFunction · 0.85

Tested by

no test coverage detected