@nuskin/cs-product-lib 1.6.2-nge1-4189.1 → 1.6.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/helpers.js +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/cs-product-lib",
3
- "version": "1.6.2-nge1-4189.1",
3
+ "version": "1.6.2",
4
4
  "description": "Library for pulling and parsing product content (and applying business logic) retrieved from Contentstack",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/helpers.js CHANGED
@@ -1214,16 +1214,16 @@ function mapUnitPrice(unitPrice) {
1214
1214
  const unitQuantity = unitPrice.unit_quantity !== undefined ? unitPrice.unit_quantity : unitPrice.unitQuantity
1215
1215
  const unitOfMeasure = unitPrice.unit_of_measure !== undefined ? unitPrice.unit_of_measure : unitPrice.unitOfMeasure
1216
1216
 
1217
- if (unitQuantity != null && (typeof unitQuantity !== 'number' || unitQuantity <= 0)) {
1217
+ if (unitQuantity != null && (!Number.isFinite(unitQuantity) || unitQuantity <= 0)) {
1218
1218
  return null
1219
1219
  }
1220
- if (unitOfMeasure != null && (typeof unitOfMeasure !== 'string' || unitOfMeasure.trim().length === 0)) {
1220
+ if (typeof unitOfMeasure !== 'string' || unitOfMeasure.trimEnd().length === 0) {
1221
1221
  return null
1222
1222
  }
1223
1223
 
1224
1224
  return {
1225
1225
  unitQuantity,
1226
- unitOfMeasure: typeof unitOfMeasure === 'string' ? unitOfMeasure.trim() : unitOfMeasure
1226
+ unitOfMeasure: unitOfMeasure.trimEnd()
1227
1227
  }
1228
1228
  }
1229
1229