Skip to content

Commit

Permalink
🎨 normalizer in array map
Browse files Browse the repository at this point in the history
  • Loading branch information
DuvCharles committed Nov 21, 2023
1 parent 39f899d commit 08b221a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/sylius/normalizer/cart-normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const normalizeCart = (syliusCart: SyliusCart): Cart => {
totalTaxAmount: normalizePrice(syliusCart.taxTotal),
shippingAmount: normalizePrice(syliusCart.shippingTotal)
},
lines: syliusCart.items.map((item) => normalizeCartItem(item)),
lines: syliusCart.items.map(normalizeCartItem),
totalQuantity: syliusCart.items.reduce((acc, item) => acc + item.quantity, 0)
};
};
Expand Down
8 changes: 4 additions & 4 deletions lib/sylius/normalizer/product-normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ export const normalizeProduct = (product: SyliusProduct): Product => ({
title: product.name,
description: product.shortDescription
},
// dont need varaints when serializing fort cart
// variants not needed for cart normalization
variants: product.variants
? product.variants.map((variant) => normalizeProductVariant(variant))
? product.variants.map(normalizeProductVariant)
: [],
images: product.images.map((image) => normalizeProductImage(image)),
images: product.images.map(normalizeProductImage),
id: product.id.toString(),
handle: product.slug,
availableForSale: product.variants.some((variant) => variant.inStock),
title: product.name,
description: product.shortDescription,
descriptionHtml: product.description,
options: product.options.map((option) => normalizeProductOption(option)),
options: product.options.map(normalizeProductOption),
priceRange: normalizePriceRange(product),
featuredImage: normalizeProductImage(product.images[0] as SyliusProductImage),
tags: [],
Expand Down

0 comments on commit 08b221a

Please sign in to comment.