MCPcopy Index your code
hub / github.com/adobe/react-spectrum / formatInterfaces

Function formatInterfaces

scripts/compareAPIs.js:668–694  ·  view source on GitHub ↗
(interfaces, allInterfaces)

Source from the content-addressed store, hash-verified

666}
667
668function formatInterfaces(interfaces, allInterfaces) {
669 return allInterfaces.map(name => {
670 let interfaceO = interfaces[name];
671 if (interfaceO && interfaceO !== 'UNTYPED') {
672 let output = `${name}`;
673 if (interfaceO.typeParameters) {
674 output += ` ${interfaceO.typeParameters}`;
675 delete interfaceO.typeParameters;
676 }
677 if (interfaceO.extend) {
678 output += ` ${interfaceO.extend}`;
679 delete interfaceO.extend;
680 }
681 // include extra newline so that the names of the interface are always compared
682 output += ' {\n\n';
683 output += interfaces[name].isType
684 ? formatProp(name, interfaceO)
685 : Object.entries(interfaceO).map(formatProp).join('\n');
686 return `${output}\n}\n`;
687 } else if (interfaceO === 'UNTYPED') {
688 // include extra newline so that the names of the interface are always compared
689 return `${name} {\n\n UNTYPED\n}\n`;
690 } else {
691 return '\n';
692 }
693 });
694}

Callers 1

getDiffFunction · 0.85

Calls 1

formatPropFunction · 0.85

Tested by

no test coverage detected