File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,13 @@ const fs = require('fs');
55
66function hash2ArrayHash ( hash , keyProperty = 'Key' , valueProperty = 'Value' ) {
77 return Object . keys ( hash )
8- . map ( key => ( {
9- [ keyProperty ] : key ,
10- [ valueProperty ] : hash [ key ]
11- } ) ) ;
8+ . map ( key => {
9+ return hash [ key ] !== undefined ? {
10+ [ keyProperty ] : key ,
11+ [ valueProperty ] : hash [ key ]
12+ } : undefined ;
13+ } )
14+ . filter ( Boolean ) ;
1215}
1316
1417function ucFirst ( str ) {
@@ -116,6 +119,10 @@ class CfnClient {
116119 let value = options [ origKey ] ;
117120 let key = ucFirst ( origKey ) ;
118121
122+ if ( value === undefined ) {
123+ return ;
124+ }
125+
119126 switch ( origKey ) {
120127 case 'parameters' :
121128 value = hash2ArrayHash ( value , 'ParameterKey' , 'ParameterValue' ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ const options = {
2323 templateBody : `file://${ templatePath } ` ,
2424 parameters : {
2525 key1 : 'val1' ,
26- key2 : 'val2'
26+ key2 : 'val2' ,
27+ key3 : undefined
2728 } ,
2829 capabilities : [ 'CAPABILITY_IAM' ] ,
2930 resourceTypes : [ 'AWS::*' ] ,
@@ -38,7 +39,8 @@ const options = {
3839 disableRollback : true ,
3940 rollbackConfiguration : {
4041 MonitoringTimeInMinutes : 10
41- }
42+ } ,
43+ dummy : undefined
4244} ;
4345
4446const templateBody = fs . readFileSync ( templatePath , { encoding : 'utf8' } ) ;
You can’t perform that action at this time.
0 commit comments