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

Function ObjectPattern

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

Source from the content-addressed store, hash-verified

416 `);
417 },
418 ObjectPattern(path) {
419 // Replace destructuring of arguments with {instancePath} with just
420 // the assignment or id for instancePath
421 const replacedPath = path.parentPath.isAssignmentPattern()
422 ? path.parentPath
423 : path;
424 if (!replacedPath.parentPath.isFunctionDeclaration()) {
425 return;
426 }
427 const {properties} = path.node;
428 const value = findProperty(properties, 'instancePath')?.value;
429 if (t.isIdentifier(value) || t.isAssignmentPattern(value)) {
430 replacedPath.replaceWith(value);
431 }
432 },
433 },
434 };
435 const result = babel.transformSync(code, {

Callers

nothing calls this directly

Calls 1

findPropertyFunction · 0.85

Tested by

no test coverage detected