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.
@@ -73,4 +73,5 @@ exports.MEASUREMENT_FIELDS_DICT = {
73
73
  innerLeg: 'Inner Leg',
74
74
  outerLeg: 'Outer Leg',
75
75
  footCircumference: 'Foot Circumference',
76
+ sleeveLength: 'Sleeve Length',
76
77
  };
@@ -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?: Measurements): string;
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 && Object.values(measurementsObj).filter((e) => e).length > 0) {
116
- const measurementStr = Object.keys(measurementsObj).reduce((acc, cur) => {
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
- return '';
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);
@@ -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
- // @ts-ignore
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "3.0.31",
3
+ "version": "3.0.32",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",