MCPcopy Create free account
hub / github.com/ampproject/amphtml / ObjectExpression

Function ObjectExpression

build-system/compile/json-schema/index.js:401–417  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

399 }
400 },
401 ObjectExpression(path) {
402 // Replace objects with {instancePath} with a string corresponding
403 // to the `instancePath`, or `instancePath` and `message` combined.
404 const {properties} = path.node;
405 const instancePath = findProperty(properties, 'instancePath');
406 if (!instancePath) {
407 return;
408 }
409 const message = findProperty(properties, 'message');
410 if (!message) {
411 path.replaceWith(instancePath.value);
412 return;
413 }
414 path.replaceWith(template.expression.ast`
415 (${instancePath.value} + ' ' + ${message.value}).trim()
416 `);
417 },
418 ObjectPattern(path) {
419 // Replace destructuring of arguments with {instancePath} with just
420 // the assignment or id for instancePath

Callers

nothing calls this directly

Calls 1

findPropertyFunction · 0.85

Tested by

no test coverage detected