@@ -62,19 +62,18 @@ function getComponentProperties(node) {
6262 case 'ClassExpression' :
6363 return node . body . body ;
6464 case 'ObjectExpression' :
65- // return node.properties;
6665 return node . properties ;
6766 default :
6867 return [ ] ;
6968 }
7069}
7170
7271/**
73- * Checks if the node is the first in its line, excluding whitespace.
74- * @param {Object } context The node to check
75- * @param {ASTNode } node The node to check
76- * @return {Boolean } true if its the first node in its line
77- */
72+ * Checks if the node is the first in its line, excluding whitespace.
73+ * @param {Object } context The node to check
74+ * @param {ASTNode } node The node to check
75+ * @return {Boolean } true if it's the first node in its line
76+ */
7877function isNodeFirstInLine ( context , node ) {
7978 const sourceCode = context . getSourceCode ( ) ;
8079 let token = node ;
@@ -94,11 +93,20 @@ function isNodeFirstInLine(context, node) {
9493 return startLine !== endLine ;
9594}
9695
96+ /**
97+ * Checks if the node is a function or arrow function expression.
98+ * @param {Object } context The node to check
99+ * @return {Boolean } true if it's a function-like expression
100+ */
101+ function isFunctionLikeExpression ( node ) {
102+ return node . type === 'FunctionExpression' || node . type === 'ArrowFunctionExpression' ;
103+ }
97104
98105module . exports = {
99106 findReturnStatement : findReturnStatement ,
100107 getPropertyName : getPropertyName ,
101108 getPropertyNameNode : getPropertyNameNode ,
102109 getComponentProperties : getComponentProperties ,
103- isNodeFirstInLine : isNodeFirstInLine
110+ isNodeFirstInLine : isNodeFirstInLine ,
111+ isFunctionLikeExpression : isFunctionLikeExpression
104112} ;
0 commit comments