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

Function createObjectMatcher

packages/compiler-core/__tests__/testUtils.ts:27–49  ·  view source on GitHub ↗
(obj: Record<string, any>)

Source from the content-addressed store, hash-verified

25// - createObjectMatcher({ 'foo': '[bar]' }) matches { foo: bar }
26// - createObjectMatcher({ '[foo]': 'bar' }) matches { [foo]: "bar" }
27export function createObjectMatcher(obj: Record<string, any>): {
28 type: NodeTypes
29 properties: Partial<Property>[]
30} {
31 return {
32 type: NodeTypes.JS_OBJECT_EXPRESSION,
33 properties: Object.keys(obj).map(key => ({
34 type: NodeTypes.JS_PROPERTY,
35 key: {
36 type: NodeTypes.SIMPLE_EXPRESSION,
37 content: key.replace(bracketsRE, ''),
38 isStatic: !leadingBracketRE.test(key),
39 } as SimpleExpressionNode,
40 value: isString(obj[key])
41 ? {
42 type: NodeTypes.SIMPLE_EXPRESSION,
43 content: obj[key].replace(bracketsRE, ''),
44 isStatic: !leadingBracketRE.test(obj[key]),
45 }
46 : obj[key],
47 })),
48 }
49}
50
51export function createElementWithCodegen(
52 tag: VNodeCall['tag'],

Callers 8

vHtml.spec.tsFile · 0.90
vText.spec.tsFile · 0.90
assertFunction · 0.90
vIf.spec.tsFile · 0.90
vSlot.spec.tsFile · 0.90
vFor.spec.tsFile · 0.90

Calls 3

isStringFunction · 0.90
mapMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected