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

Function createSlotMatcher

packages/compiler-core/__tests__/transforms/vSlot.spec.ts:68–91  ·  view source on GitHub ↗
(obj: Record<string, any>, isDynamic = false)

Source from the content-addressed store, hash-verified

66}
67
68function createSlotMatcher(obj: Record<string, any>, isDynamic = false) {
69 return {
70 type: NodeTypes.JS_OBJECT_EXPRESSION,
71 properties: Object.keys(obj)
72 .map(key => {
73 return {
74 type: NodeTypes.JS_PROPERTY,
75 key: {
76 type: NodeTypes.SIMPLE_EXPRESSION,
77 isStatic: !/^\[/.test(key),
78 content: key.replace(/^\[|\]$/g, ''),
79 },
80 value: obj[key],
81 } as any
82 })
83 .concat({
84 key: { content: `_` },
85 value: {
86 content: isDynamic ? `2 /* DYNAMIC */` : `1 /* STABLE */`,
87 isStatic: false,
88 },
89 }),
90 }
91}
92
93describe('compiler: transform component slots', () => {
94 test('implicit default slot', () => {

Callers 1

vSlot.spec.tsFile · 0.85

Calls 2

mapMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected