rerobe-js-orm 2.7.29 → 2.7.31

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.
@@ -3,6 +3,7 @@ export default class ReRobeProductHelpers {
3
3
  static calculateFulfillmentFee(commission: number): number;
4
4
  static calculateSalePrice(productObj: CompleteProduct): string;
5
5
  static isValidCommission(commission: any): boolean;
6
+ static isValidVendorName(name: string): boolean;
6
7
  static commissionFixer(commisssion: any): string;
7
8
  static isValidSalePrice(productObj: CompleteProduct): boolean;
8
9
  static buildReRobeEarnings(arrayLike: CompleteProduct | CompleteProduct[]): number[];
@@ -47,6 +47,12 @@ class ReRobeProductHelpers {
47
47
  }
48
48
  return false;
49
49
  }
50
+ static isValidVendorName(name) {
51
+ if (name && typeof name === 'string') {
52
+ return true;
53
+ }
54
+ return false;
55
+ }
50
56
  static commissionFixer(commisssion) {
51
57
  let fix = String(commisssion);
52
58
  if (fix.includes(',')) {
@@ -14,4 +14,6 @@ export default class Utilities {
14
14
  sanitzeStringArr(v: any): string[];
15
15
  sanitizeNumber(v: any, to?: number): number;
16
16
  sanitizeMillisTimeStamp(t: any): number;
17
+ isProperString(name: any): boolean;
18
+ toProperString(name: any): string;
17
19
  }
@@ -88,5 +88,45 @@ class Utilities {
88
88
  }
89
89
  return 0;
90
90
  }
91
+ isProperString(name) {
92
+ // Check if the name is a string
93
+ if (typeof name !== 'string') {
94
+ return false;
95
+ }
96
+ // Check if the name has more than one word (i.e. contains a space)
97
+ if (/\s/.test(name)) {
98
+ // Split the name into an array of words
99
+ const words = name.split(' ');
100
+ // Check if each word is a proper string (i.e. not empty and doesn't contain any whitespace)
101
+ for (const word of words) {
102
+ if (!word || /\s/.test(word)) {
103
+ return false;
104
+ }
105
+ }
106
+ }
107
+ else {
108
+ // If the name is a single word, check if it is a proper string
109
+ if (!name || /\s/.test(name)) {
110
+ return false;
111
+ }
112
+ }
113
+ // If the name is a string and doesn't have any whitespace, it is a proper string
114
+ return true;
115
+ }
116
+ toProperString(name) {
117
+ // Check if the name is a string
118
+ if (typeof name !== 'string') {
119
+ // If the name is not a string, return an empty string
120
+ return '';
121
+ }
122
+ // Remove any consecutive whitespace characters from the name
123
+ name = name.replace(/\s+/g, ' ');
124
+ // Remove any leading or trailing whitespace from the name
125
+ name = name.trim();
126
+ // Split the name into an array of words
127
+ const words = name.split(' ');
128
+ // Capitalize each word and join the words together
129
+ return words.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
130
+ }
91
131
  }
92
132
  exports.default = Utilities;
@@ -356,9 +356,12 @@ class Product extends Base_1.default {
356
356
  if (productType === 'Suit Jacket' || productType === 'Shirts & Blouses' || productType === 'Outerwear') {
357
357
  productType = '';
358
358
  }
359
- if (['Blazers', 'Dresses', 'Jumpsuits', 'Skirts', 'Tops'].includes(productType)) {
359
+ if (['Blazers', 'Jumpsuits', 'Skirts', 'Tops'].includes(productType)) {
360
360
  productType = productType.substring(0, productType.length - 1);
361
361
  }
362
+ if (productType === 'Dresses') {
363
+ productType = 'Dress';
364
+ }
362
365
  let result;
363
366
  if (brand.includes('Vintage')) {
364
367
  if (productType !== '') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.7.29",
3
+ "version": "2.7.31",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",