Skip to content

Commit e9a1e7d

Browse files
committed
Fix else is not necessary here
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
1 parent 7c6428e commit e9a1e7d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

utils/functions/functions.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,13 @@ export const getUpdatedProducts = (
112112
);
113113

114114
return updatedProducts;
115-
} else {
116-
// If product not found push the new product to the existing product array.
117-
let productPrice = getFloatVal(product.price);
118-
const newProduct = createNewProduct(product, productPrice, qtyToBeAdded);
119-
existingProductsInCart.push(newProduct);
120-
121-
return existingProductsInCart;
122115
}
116+
// If product not found push the new product to the existing product array.
117+
let productPrice = getFloatVal(product.price);
118+
const newProduct = createNewProduct(product, productPrice, qtyToBeAdded);
119+
existingProductsInCart.push(newProduct);
120+
121+
return existingProductsInCart;
123122
};
124123

125124
/**

0 commit comments

Comments
 (0)