Skip to content

Commit e30b229

Browse files
authored
Merge pull request #399 from w3bdesign/develop
else is not necessary here
2 parents 72f2fe6 + a07c6a4 commit e30b229

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

utils/functions/functions.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ import { v4 as uuidv4 } from 'uuid';
33
import WOO_CONFIG from 'utils/config/nextConfig';
44

55
/**
6-
* Shorten inputted string (usually product description) to a maximum of 20 characters
6+
* Shorten inputted string (usually product description) to a maximum of length
77
* @param {String} string The string that we input
88
* @param {Integer} length The length that we want to shorten the text to
99
*/
1010
export const trimmedStringToLength = (string, length) => {
1111
if (string.length > length) {
1212
const subStr = string.substring(0, length);
1313
return subStr + '...';
14-
} else {
15-
return string;
1614
}
15+
return string;
1716
};
1817

1918
/**
@@ -46,18 +45,14 @@ export const getFloatVal = (string) => {
4645
*/
4746
export const getFormattedCart = (data) => {
4847
let formattedCart = null;
49-
5048
if (!data || !data.cart.contents.nodes.length) {
5149
return formattedCart;
5250
}
53-
5451
const givenProducts = data.cart.contents.nodes;
55-
5652
// Create an empty object.
5753
formattedCart = {};
5854
formattedCart.products = [];
5955
let totalProductsCount = 0;
60-
6156
let i = 0;
6257
givenProducts.forEach(() => {
6358
const givenProduct = givenProducts[parseInt(i, 10)].product;

0 commit comments

Comments
 (0)