conditionally accesses properties (#2047)

This commit is contained in:
Marty 2024-04-09 13:18:44 -07:00 committed by GitHub
parent 0173d8812d
commit 615ed0c584
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,7 +49,7 @@ export const exportCollection = (collection) => {
const generateEventSection = (item) => {
const eventArray = [];
if (item.request.tests.length) {
if (item?.request?.tests?.length) {
eventArray.push({
listen: 'test',
script: {
@ -58,7 +58,7 @@ export const exportCollection = (collection) => {
}
});
}
if (item.request.script.req) {
if (item?.request?.script?.req) {
eventArray.push({
listen: 'prerequest',
script: {