eslint-plugin-perfectionist
Version:
ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
19 lines (18 loc) • 485 B
JavaScript
import { AST_NODE_TYPES } from '@typescript-eslint/utils'
/**
* Checks whether a node is a function expression or an arrow function
* expression.
*
* @param node - The AST node to check.
* @returns Whether the node is a function expression.
*/
function isFunctionExpression(node) {
if (!node) {
return false
}
return (
node.type === AST_NODE_TYPES.ArrowFunctionExpression ||
node.type === AST_NODE_TYPES.FunctionExpression
)
}
export { isFunctionExpression }