Skip to content

Commit 177e78f

Browse files
authored
Merge pull request #393 from w3bdesign/develop
Fixing Codacy issues
2 parents 593dfc2 + 885842b commit 177e78f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

utils/functions/functions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ export const getFormattedCart = (data) => {
6060

6161
let i = 0;
6262
givenProducts.forEach(() => {
63-
const givenProduct = givenProducts[parseInt(i)].product;
63+
const givenProduct = givenProducts[parseInt(i,10)].product;
6464
const product = {};
6565
// Convert price to a float value
66-
const convertedCurrency = givenProducts[i].total.replace(/[^0-9.-]+/g, '');
66+
const convertedCurrency = givenProducts[parseInt(i,10)].total.replace(/[^0-9.-]+/g, '');
6767

6868
product.productId = givenProduct.productId;
69-
product.cartKey = givenProducts[i].key;
69+
product.cartKey = givenProducts[parseInt(i,10)].key;
7070
product.name = givenProduct.name;
71-
product.qty = givenProducts[i].quantity;
71+
product.qty = givenProducts[parseInt(i,10)].quantity;
7272
product.price = convertedCurrency / product.qty;
73-
product.totalPrice = givenProducts[i].total;
73+
product.totalPrice = givenProducts[parseInt(i,10)].total;
7474
// Ensure we can add products without images to the cart
7575
givenProduct.image
7676
? (product.image = {
@@ -84,7 +84,7 @@ export const getFormattedCart = (data) => {
8484
title: givenProduct.name,
8585
});
8686

87-
totalProductsCount += givenProducts[i].quantity;
87+
totalProductsCount += givenProducts[parseInt(i,10)].quantity;
8888
// Push each item into the products array.
8989
formattedCart.products.push(product);
9090
i++;

0 commit comments

Comments
 (0)