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

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

Pred finalna verzija

  • Property mode set to 100644
File size: 894 bytes
RevLine 
[d565449]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) {
[0c6b92a]13 if (!node.callee) {
14 return false;
15 }
16
[d565449]17 if (
[0c6b92a]18 node.callee.type === 'MemberExpression'
[d565449]19 && node.callee.property.name === 'createElement'
20 && node.callee.object
21 && node.callee.object.name === pragmaUtil.getFromContext(context)
22 ) {
23 return true;
24 }
25
26 if (
[0c6b92a]27 node.callee.name === 'createElement'
[d565449]28 && isDestructuredFromPragmaImport(context, node, 'createElement')
29 ) {
30 return true;
31 }
32
33 return false;
34};
Note: See TracBrowser for help on using the repository browser.