import { Node } from 'estree-walker' ; interface Extractors { [ key ] : ( names : Array < string > , param : Node ) => void ; } const extractors = { ArrayPattern ( names , param ) { for ( const element of param . elements ) { if ( element ) extractors [ element . type ] ( names , element ) ; } } , AssignmentPattern ( names , param ) { extractors [ param . left . type ] ( names , param . left ) ; } , Identifier ( names , param ) { names . push ( param . name ) ; } , MemberExpression ( ) { } , ObjectPattern ( names , param ) { for ( const prop of param . properties ) { if ( prop . type === 'RestElement' ) { extractors . RestElement ( names , prop ) ; } else { extractors [ prop . value . type ] ( names , prop . value ) ; } } } , RestElement ( names , param ) { extractors [ param . argument . type ] ( names , param . argument ) ; } } ; const extractAssignedNames = function extractAssignedNames ( param ) : Array < string > { const names = [ ] ; extractors [ param . type ] ( names , param ) ; return names ; } ; export { extractAssignedNames as default } ;