From 14b92fea37eda71b82afeecdeea5890672fc9674 Mon Sep 17 00:00:00 2001 From: Chris Van Emmerik Date: Tue, 30 Jan 2024 15:13:12 -0700 Subject: [PATCH 1/2] Format customs fix --- src/get-rates-with-shipment-details/format-response.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/get-rates-with-shipment-details/format-response.ts b/src/get-rates-with-shipment-details/format-response.ts index 02093fdd..08880fc6 100644 --- a/src/get-rates-with-shipment-details/format-response.ts +++ b/src/get-rates-with-shipment-details/format-response.ts @@ -240,10 +240,10 @@ function formatCustoms( customs: Response.InternationalShipmentOptions ): GetRatesWithShipmentDetailsTypes.Result["customs"] | null { return { - contents: customs.contents, - nonDelivery: customs.non_delivery, - customsItems: customs.customs_items - ? formatCustomsItems(customs.customs_items) + contents: customs?.contents, + nonDelivery: customs?.non_delivery, + customsItems: customs?.customs_items ?? [] + ? formatCustomsItems(customs?.customs_items ?? []) : null, }; } From 6b33280f57105886a8376f57a02065d1789fbe3b Mon Sep 17 00:00:00 2001 From: Chris Van Emmerik Date: Tue, 30 Jan 2024 16:52:25 -0700 Subject: [PATCH 2/2] Remove un-necessary collesce operators --- src/get-rates-with-shipment-details/format-response.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/get-rates-with-shipment-details/format-response.ts b/src/get-rates-with-shipment-details/format-response.ts index 08880fc6..1bac691b 100644 --- a/src/get-rates-with-shipment-details/format-response.ts +++ b/src/get-rates-with-shipment-details/format-response.ts @@ -242,8 +242,8 @@ function formatCustoms( return { contents: customs?.contents, nonDelivery: customs?.non_delivery, - customsItems: customs?.customs_items ?? [] - ? formatCustomsItems(customs?.customs_items ?? []) + customsItems: customs?.customs_items + ? formatCustomsItems(customs.customs_items) : null, }; }