Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilli-shop-client

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilli-shop-client - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

3

dist/models/product.d.ts
import { IBaseDto, IPropertyDto } from "./base";
import { IParameter } from "./parameter";
export interface IProductBaseDto extends IBaseDto {

@@ -30,2 +31,4 @@ ref: string;

export declare class ProductDetails {
static getCurrentPrice(product: IProductBaseDto, parameters?: IParameter[]): number;
static getPrice(defaultPrice: number, parameters?: IParameter[]): number;
static getProperty(properties: IPropertyDto[] | undefined, key: string): string | undefined;

@@ -32,0 +35,0 @@ }

@@ -33,2 +33,22 @@ "use strict";

}
ProductDetails.getCurrentPrice = function (product, parameters) {
var discountPrice = product.discountPrice;
if (discountPrice) {
return discountPrice;
}
return this.getPrice(product.currentPrice, parameters);
};
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;
}
}
}
return maxPrice;
};
ProductDetails.getProperty = function (properties, key) {

@@ -35,0 +55,0 @@ var property = properties === null || properties === void 0 ? void 0 : properties.find(function (x) { return x.key === key; });

2

package.json
{
"name": "vanilli-shop-client",
"version": "1.3.0",
"version": "1.3.1",
"description": "Client for Vanilli Shop API",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import {IBaseDto, IPropertyDto} from "./base";
import {IParameter} from "./parameter";

@@ -54,2 +55,28 @@ export interface IProductBaseDto extends IBaseDto {

export class ProductDetails {
static getCurrentPrice(product: IProductBaseDto, parameters?: IParameter[]): number {
const discountPrice = product.discountPrice;
if (discountPrice) {
return discountPrice;
}
return this.getPrice(product.currentPrice, parameters);
}
static getPrice(defaultPrice: number, parameters?: IParameter[]): number {
let maxPrice = defaultPrice;
if (parameters) {
for (const parameter of parameters) {
const price = parameter.price;
if (price && price > maxPrice) {
maxPrice = price;
}
}
}
return maxPrice;
}
static getProperty(properties: IPropertyDto[] | undefined, key: string): string | undefined {

@@ -56,0 +83,0 @@ const property = properties?.find(x => x.key === key);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc