@softwear/latestcollectioncore 1.0.142 → 1.0.143

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.
package/dist/hashBrand.js CHANGED
@@ -6,7 +6,7 @@ const DIACRITIC_REGEX = /[\u0300-\u036f]/g;
6
6
  // Note: '-' is placed at the end of the class so it is treated literally,
7
7
  // and '\' is escaped.
8
8
  const REMOVE_CHARS_TEST_REGEX = /[~.<>!@#$%^&*():'"? \/\\-]/;
9
- const REMOVE_CHARS_REGEX = /[~.<>!@#$%^&*():'"? \/\\-]/g;
9
+ const REMOVE_CHARS_REGEX = /[~.<>!@#$%^&*()'"? \/\\-]/g;
10
10
  // Fast check: returns true if the string contains any non-ASCII character,
11
11
  // which we treat as a potential diacritic and normalize only in that case.
12
12
  function hasPotentialDiacritics(str) {
@@ -23,9 +23,7 @@ function default_1(brand = '') {
23
23
  // Only pay the cost of normalization when we actually see potential diacritics.
24
24
  if (hasPotentialDiacritics(brand))
25
25
  normalized = brand.normalize('NFD').replace(DIACRITIC_REGEX, '');
26
- const withoutUnwantedChars = REMOVE_CHARS_TEST_REGEX.test(normalized)
27
- ? normalized.replace(REMOVE_CHARS_REGEX, '')
28
- : normalized;
26
+ const withoutUnwantedChars = REMOVE_CHARS_TEST_REGEX.test(normalized) ? normalized.replace(REMOVE_CHARS_REGEX, '') : normalized;
29
27
  // const withoutUnwantedChars = normalized.replace(REMOVE_CHARS_REGEX, '')
30
28
  return withoutUnwantedChars.toLowerCase();
31
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.142",
3
+ "version": "1.0.143",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/hashBrand.ts CHANGED
@@ -4,7 +4,7 @@ const DIACRITIC_REGEX = /[\u0300-\u036f]/g
4
4
  // Note: '-' is placed at the end of the class so it is treated literally,
5
5
  // and '\' is escaped.
6
6
  const REMOVE_CHARS_TEST_REGEX = /[~.<>!@#$%^&*():'"? \/\\-]/
7
- const REMOVE_CHARS_REGEX = /[~.<>!@#$%^&*():'"? \/\\-]/g
7
+ const REMOVE_CHARS_REGEX = /[~.<>!@#$%^&*()'"? \/\\-]/g
8
8
 
9
9
  // Fast check: returns true if the string contains any non-ASCII character,
10
10
  // which we treat as a potential diacritic and normalize only in that case.
@@ -22,10 +22,8 @@ export default function (brand = ''): string {
22
22
  // Only pay the cost of normalization when we actually see potential diacritics.
23
23
  if (hasPotentialDiacritics(brand)) normalized = brand.normalize('NFD').replace(DIACRITIC_REGEX, '')
24
24
 
25
- const withoutUnwantedChars = REMOVE_CHARS_TEST_REGEX.test(normalized)
26
- ? normalized.replace(REMOVE_CHARS_REGEX, '')
27
- : normalized
28
- // const withoutUnwantedChars = normalized.replace(REMOVE_CHARS_REGEX, '')
25
+ const withoutUnwantedChars = REMOVE_CHARS_TEST_REGEX.test(normalized) ? normalized.replace(REMOVE_CHARS_REGEX, '') : normalized
26
+ // const withoutUnwantedChars = normalized.replace(REMOVE_CHARS_REGEX, '')
29
27
 
30
28
  return withoutUnwantedChars.toLowerCase()
31
29
  }