MCPcopy Create free account
hub / github.com/adobe/react-spectrum / isReactCall

Function isReactCall

packages/dev/parcel-transformer-docs/DocsTransformer.js:784–805  ·  view source on GitHub ↗
(path, name, module = 'react')

Source from the content-addressed store, hash-verified

782 }
783
784 function isReactCall(path, name, module = 'react') {
785 if (!path.isCallExpression()) {
786 return false;
787 }
788
789 let callee = path.node.callee;
790 let calleePath = path.get('callee');
791 if (t.isTSAsExpression(callee)) {
792 callee = callee.expression;
793 calleePath = calleePath.get('expression');
794 }
795
796 if (!t.isMemberExpression(callee)) {
797 return calleePath.referencesImport(module, name);
798 }
799
800 if (calleePath.get('object').referencesImport(module, 'default')) {
801 return t.isIdentifier(callee.property, {name});
802 }
803
804 return false;
805 }
806
807 function isReactComponent(path) {
808 if (path.isFunction()) {

Callers 2

isReactForwardRefFunction · 0.85
ReturnStatementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected