@@ -737,29 +737,27 @@ module.exports = {
737737 }
738738 } )
739739 } else {
740- return propsNode . value . elements
741- . filter ( ( prop ) => prop )
742- . map ( ( prop ) => {
743- if ( prop . type === 'Literal' || prop . type === 'TemplateLiteral' ) {
744- const propName = getStringLiteralValue ( prop )
745- if ( propName != null ) {
746- return {
747- type : 'array' ,
748- key : prop ,
749- propName,
750- value : null ,
751- node : prop
752- }
740+ return propsNode . value . elements . filter ( isDef ) . map ( ( prop ) => {
741+ if ( prop . type === 'Literal' || prop . type === 'TemplateLiteral' ) {
742+ const propName = getStringLiteralValue ( prop )
743+ if ( propName != null ) {
744+ return {
745+ type : 'array' ,
746+ key : prop ,
747+ propName,
748+ value : null ,
749+ node : prop
753750 }
754751 }
755- return {
756- type : 'array' ,
757- key : null ,
758- propName : null ,
759- value : null ,
760- node : prop
761- }
762- } )
752+ }
753+ return {
754+ type : 'array' ,
755+ key : null ,
756+ propName : null ,
757+ value : null ,
758+ node : prop
759+ }
760+ } )
763761 }
764762 } ,
765763
@@ -810,29 +808,27 @@ module.exports = {
810808 }
811809 } )
812810 } else {
813- return emitsNode . value . elements
814- . filter ( ( prop ) => prop )
815- . map ( ( prop ) => {
816- if ( prop . type === 'Literal' || prop . type === 'TemplateLiteral' ) {
817- const emitName = getStringLiteralValue ( prop )
818- if ( emitName != null ) {
819- return {
820- type : 'array' ,
821- key : prop ,
822- emitName,
823- value : null ,
824- node : prop
825- }
811+ return emitsNode . value . elements . filter ( isDef ) . map ( ( prop ) => {
812+ if ( prop . type === 'Literal' || prop . type === 'TemplateLiteral' ) {
813+ const emitName = getStringLiteralValue ( prop )
814+ if ( emitName != null ) {
815+ return {
816+ type : 'array' ,
817+ key : prop ,
818+ emitName,
819+ value : null ,
820+ node : prop
826821 }
827822 }
828- return {
829- type : 'array' ,
830- key : null ,
831- emitName : null ,
832- value : null ,
833- node : prop
834- }
835- } )
823+ }
824+ return {
825+ type : 'array' ,
826+ key : null ,
827+ emitName : null ,
828+ value : null ,
829+ node : prop
830+ }
831+ } )
836832 }
837833 } ,
838834
@@ -1109,7 +1105,10 @@ module.exports = {
11091105 */
11101106 * iterateArrayExpression ( node , groupName ) {
11111107 for ( const item of node . elements ) {
1112- if ( item . type === 'Literal' || item . type === 'TemplateLiteral' ) {
1108+ if (
1109+ item &&
1110+ ( item . type === 'Literal' || item . type === 'TemplateLiteral' )
1111+ ) {
11131112 const name = getStringLiteralValue ( item )
11141113 if ( name ) {
11151114 yield { type : 'array' , name, groupName, node : item }
0 commit comments