source: imaps-frontend/node_modules/eslint-plugin-react/lib/util/isCreateElement.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 899 bytes
Line 
1'use strict';
2
3const pragmaUtil = require('./pragma');
4const isDestructuredFromPragmaImport = require('./isDestructuredFromPragmaImport');
5
6/**
7 * Checks if the node is a createElement call
8 * @param {Context} context - The AST node being checked.
9 * @param {ASTNode} node - The AST node being checked.
10 * @returns {boolean} - True if node is a createElement call object literal, False if not.
11*/
12module.exports = function isCreateElement(context, node) {
13 if (
14 node.callee
15 && node.callee.type === 'MemberExpression'
16 && node.callee.property.name === 'createElement'
17 && node.callee.object
18 && node.callee.object.name === pragmaUtil.getFromContext(context)
19 ) {
20 return true;
21 }
22
23 if (
24 node
25 && node.callee
26 && node.callee.name === 'createElement'
27 && isDestructuredFromPragmaImport(context, node, 'createElement')
28 ) {
29 return true;
30 }
31
32 return false;
33};
Note: See TracBrowser for help on using the repository browser.