diff --git a/library/src/helpers/message.ts b/library/src/helpers/message.ts index 398700a80..82356dde9 100644 --- a/library/src/helpers/message.ts +++ b/library/src/helpers/message.ts @@ -53,7 +53,7 @@ export class MessageHelpers { } const payload = msg.payload(); - if (payload && payload.examples()) { + if (payload?.examples()) { return payload.examples()?.map(example => ({ example })); } @@ -84,7 +84,7 @@ export class MessageHelpers { } const headers = msg.headers(); - if (headers && headers.examples()) { + if (headers?.examples()) { return headers.examples()?.map(example => ({ example })); }