@@ -102,11 +102,41 @@ function isFunctionLikeExpression(node) {
102
102
return node . type === 'FunctionExpression' || node . type === 'ArrowFunctionExpression' ;
103
103
}
104
104
105
+ /**
106
+ * Checks if the node is a function.
107
+ * @param {Object } context The node to check
108
+ * @return {Boolean } true if it's a function
109
+ */
110
+ function isFunction ( node ) {
111
+ return node . type === 'FunctionExpression' || node . type === 'FunctionDeclaration' ;
112
+ }
113
+
114
+ /**
115
+ * Checks if the node is an arrow function.
116
+ * @param {Object } context The node to check
117
+ * @return {Boolean } true if it's an arrow function
118
+ */
119
+ function isArrowFunction ( node ) {
120
+ return node . type === 'ArrowFunctionExpression' ;
121
+ }
122
+
123
+ /**
124
+ * Checks if the node is a class.
125
+ * @param {Object } context The node to check
126
+ * @return {Boolean } true if it's a class
127
+ */
128
+ function isClass ( node ) {
129
+ return node . type === 'ClassDeclaration' || node . type === 'ClassExpression' ;
130
+ }
131
+
105
132
module . exports = {
106
133
findReturnStatement : findReturnStatement ,
107
134
getPropertyName : getPropertyName ,
108
135
getPropertyNameNode : getPropertyNameNode ,
109
136
getComponentProperties : getComponentProperties ,
110
- isNodeFirstInLine : isNodeFirstInLine ,
111
- isFunctionLikeExpression : isFunctionLikeExpression
137
+ isArrowFunction : isArrowFunction ,
138
+ isClass : isClass ,
139
+ isFunction : isFunction ,
140
+ isFunctionLikeExpression : isFunctionLikeExpression ,
141
+ isNodeFirstInLine : isNodeFirstInLine
112
142
} ;
0 commit comments