@@ -737,29 +737,27 @@ module.exports = {
737
737
}
738
738
} )
739
739
} 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
753
750
}
754
751
}
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
+ } )
763
761
}
764
762
} ,
765
763
@@ -810,29 +808,27 @@ module.exports = {
810
808
}
811
809
} )
812
810
} 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
826
821
}
827
822
}
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
+ } )
836
832
}
837
833
} ,
838
834
@@ -1109,7 +1105,10 @@ module.exports = {
1109
1105
*/
1110
1106
* iterateArrayExpression ( node , groupName ) {
1111
1107
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
+ ) {
1113
1112
const name = getStringLiteralValue ( item )
1114
1113
if ( name ) {
1115
1114
yield { type : 'array' , name, groupName, node : item }
0 commit comments