serverless-plugin-ifelse
serverless-plugin-ifelse copied to clipboard
feat: make exclude on array items remove them completely
This PR adds support for completely removing excluded array indices.
Before
custom: {
cors: {
headers: [
"X-Prod-Specific-Header-1",
"Normal-Header",
"X-Prod-Specific-Header-2"
]
}
},
and
Exclude: [
"custom.cors.headers.0",
"custom.cors.headers.2",
],
results in
custom: {
cors: {
headers: [
undefined,
"Normal-Header",
undefined
]
}
},
After
The result will be
custom: {
cors: {
headers: [
"Normal-Header",
]
}
},
Why
The motivation for this change is that, in our use-case, CloudFormation crashed when it ran into the excluded undefined
item in the array. If we remove the item completely, it works as it should.
Note
:firecracker: BREAKING CHANGE: Exclusion of an array item now removes it completely instead of keeping undefined on its index.
This should also fix this reported issue