From 229aa2f4bf952d2cf28f25a243e16e8f35234450 Mon Sep 17 00:00:00 2001 From: Paras Date: Sun, 8 Oct 2023 03:43:13 +0530 Subject: [PATCH] refactor: add optional chain expressions (#812) Co-authored-by: Lukasz Gornicki --- library/src/helpers/message.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 })); }