import { types as t, NodePath } from '@babel/core'; import { getVariableDeclarationProps } from './get-variable-declaration-props'; import { getFunctionDeclarationProps } from './get-function-declaration-props'; export const getPropsFormPath = ( path: NodePath | NodePath, ) => { const { node } = path; if (t.isVariableDeclaration(node)) { return getVariableDeclarationProps(path as NodePath); } else if (t.isFunctionDeclaration(node)) { return getFunctionDeclarationProps(path as NodePath); } return undefined; };