rerobe-js-orm 3.0.31 → 3.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ export default class ReRobeProductHelpers {
|
|
|
9
9
|
static buildReRobeEarnings(arrayLike: CompleteProduct | CompleteProduct[]): number[];
|
|
10
10
|
static buildReRobeEarningsV2(arrayLike: CompleteProduct | CompleteProduct[], isCanonicalMerchant?: boolean): number[];
|
|
11
11
|
static materialCompJoinedString(materialComposition?: MaterialComposition): string;
|
|
12
|
-
static measurementsJoinedString(measurementsObj
|
|
12
|
+
static measurementsJoinedString(measurementsObj: Measurements): string;
|
|
13
13
|
static sizeCommentPretty(sizeComment: string): string;
|
|
14
14
|
static getSizeLabel(clothingSize: string[], shoeSize: string, jeanSize: string): string;
|
|
15
15
|
static generateArrForDetailsBulletList(productObj: CompleteProduct): string[];
|
|
@@ -111,23 +111,20 @@ class ReRobeProductHelpers {
|
|
|
111
111
|
}
|
|
112
112
|
return '';
|
|
113
113
|
}
|
|
114
|
-
static measurementsJoinedString(measurementsObj
|
|
115
|
-
if (measurementsObj
|
|
116
|
-
|
|
117
|
-
let result = acc;
|
|
118
|
-
if (cur !== 'unit') {
|
|
119
|
-
if (measurementsObj[cur]) {
|
|
120
|
-
if (acc === '') {
|
|
121
|
-
return (result = `${measurementsObj[cur]} ${measurementsObj.unit} ${cur}`);
|
|
122
|
-
}
|
|
123
|
-
return (result = `${measurementsObj[cur]} ${measurementsObj.unit} ${cur} x ${acc}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return result;
|
|
127
|
-
}, '');
|
|
128
|
-
return measurementStr;
|
|
114
|
+
static measurementsJoinedString(measurementsObj) {
|
|
115
|
+
if (typeof measurementsObj !== 'object' || measurementsObj == null) {
|
|
116
|
+
return '';
|
|
129
117
|
}
|
|
130
|
-
|
|
118
|
+
if (Object.keys(measurementsObj).length === 0) {
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
121
|
+
return Object.keys(measurementsObj)
|
|
122
|
+
.filter((key) => key !== 'unit' && !!measurementsObj[key])
|
|
123
|
+
.map((key) => {
|
|
124
|
+
const label = product_constants_1.MEASUREMENT_FIELDS_DICT[key] || lodash_1.startCase(key);
|
|
125
|
+
return `${measurementsObj[key]} ${measurementsObj.unit} ${label}`;
|
|
126
|
+
})
|
|
127
|
+
.join(' x ');
|
|
131
128
|
}
|
|
132
129
|
static sizeCommentPretty(sizeComment) {
|
|
133
130
|
const scO = options_1.sizeCommentOptions.filter((o) => o.value === sizeComment);
|
package/lib/models/Product.js
CHANGED
|
@@ -843,13 +843,11 @@ class Product extends Base_1.default {
|
|
|
843
843
|
return '';
|
|
844
844
|
}
|
|
845
845
|
return Object.keys(measurementsObj)
|
|
846
|
-
.filter((key) => key !== 'unit')
|
|
846
|
+
.filter((key) => key !== 'unit' && !!measurementsObj[key])
|
|
847
847
|
.map((key) => {
|
|
848
|
-
|
|
849
|
-
const label = product_constants_1.MEASUREMENT_FIELDS_DICT[key] || key;
|
|
848
|
+
const label = product_constants_1.MEASUREMENT_FIELDS_DICT[key] || this.utilities.startCase(key);
|
|
850
849
|
return `${measurementsObj[key]} ${measurementsObj.unit} ${label}`;
|
|
851
850
|
})
|
|
852
|
-
.reverse()
|
|
853
851
|
.join(' x ');
|
|
854
852
|
}
|
|
855
853
|
convertMaterialCompJoinedStrToObj(materialCompJoinedString) {
|