project bootstrap

This commit is contained in:
2023-11-25 18:12:47 -05:00
parent 5cd875ae80
commit 6ef22d88f9
39139 changed files with 4944609 additions and 2 deletions
+53
View File
@@ -0,0 +1,53 @@
'use strict';
/**
* Checks if the node is a React.createContext call
* @param {ASTNode} node - The AST node being checked.
* @returns {Boolean} - True if node is a React.createContext call, false if not.
*/
module.exports = function isCreateContext(node) {
if (
node.init
&& node.init.type === 'CallExpression'
&& node.init.callee
&& node.init.callee.name === 'createContext'
) {
return true;
}
if (
node.init
&& node.init.callee
&& node.init.callee.type === 'MemberExpression'
&& node.init.callee.property
&& node.init.callee.property.name === 'createContext'
) {
return true;
}
if (
node.expression
&& node.expression.type === 'AssignmentExpression'
&& node.expression.operator === '='
&& node.expression.right.type === 'CallExpression'
&& node.expression.right.callee
&& node.expression.right.callee.name === 'createContext'
) {
return true;
}
if (
node.expression
&& node.expression.type === 'AssignmentExpression'
&& node.expression.operator === '='
&& node.expression.right.type === 'CallExpression'
&& node.expression.right.callee
&& node.expression.right.callee.type === 'MemberExpression'
&& node.expression.right.callee.property
&& node.expression.right.callee.property.name === 'createContext'
) {
return true;
}
return false;
};