vanilli-shop-client
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -41,13 +41,14 @@ "use strict"; | ||
ProductDetails.getPrice = function (defaultPrice, parameters) { | ||
var maxPrice = defaultPrice; | ||
if (parameters) { | ||
for (var _i = 0, parameters_1 = parameters; _i < parameters_1.length; _i++) { | ||
var parameter = parameters_1[_i]; | ||
var price = parameter.price; | ||
if (price && price > maxPrice) { | ||
maxPrice = price; | ||
} | ||
if (!parameters) { | ||
return defaultPrice; | ||
} | ||
var maxPrice = 0; | ||
for (var _i = 0, parameters_1 = parameters; _i < parameters_1.length; _i++) { | ||
var parameter = parameters_1[_i]; | ||
var price = parameter.price; | ||
if (price && price > maxPrice) { | ||
maxPrice = price; | ||
} | ||
} | ||
return maxPrice; | ||
return maxPrice > 0 ? maxPrice : defaultPrice; | ||
}; | ||
@@ -54,0 +55,0 @@ ProductDetails.getProperty = function (properties, key) { |
{ | ||
"name": "vanilli-shop-client", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Client for Vanilli Shop API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -66,15 +66,17 @@ import {IBaseDto, IPropertyDto} from "./base"; | ||
static getPrice(defaultPrice: number, parameters?: IParameter[]): number { | ||
let maxPrice = defaultPrice; | ||
if (!parameters) { | ||
return defaultPrice; | ||
} | ||
if (parameters) { | ||
for (const parameter of parameters) { | ||
const price = parameter.price; | ||
let maxPrice = 0; | ||
if (price && price > maxPrice) { | ||
maxPrice = price; | ||
} | ||
for (const parameter of parameters) { | ||
const price = parameter.price; | ||
if (price && price > maxPrice) { | ||
maxPrice = price; | ||
} | ||
} | ||
return maxPrice; | ||
return maxPrice > 0 ? maxPrice : defaultPrice; | ||
} | ||
@@ -81,0 +83,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222751
4950