🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

ysk-utils

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ysk-utils - npm Package Compare versions

Comparing version
1.0.85
to
1.0.87
+7
-4
dist/goods.js

@@ -530,6 +530,9 @@ "use strict";

for (const goods of goodsList) {
const availableNum = Math.max(0, goods.number - (goods.returnNum || 0));
// ✅ 强制转数字,彻底解决 NaN
const availableNum = Number(goods.number || 0) - Number(goods.returnNum || 0);
const safeNum = Math.max(0, availableNum);
let basePrice = new bignumber_js_1.BigNumber(0);
if (goods.is_temporary || goods.isTemporary) {
basePrice = new bignumber_js_1.BigNumber(goods?.discountSaleAmount ?? 0);
// ✅ 也强制转数字
basePrice = new bignumber_js_1.BigNumber(Number(goods.discountSaleAmount) || 0);
}

@@ -540,5 +543,5 @@ else if (goods.is_gift || goods.isGift) {

else {
basePrice = new bignumber_js_1.BigNumber(goods.skuData?.salePrice ?? goods.salePrice); // SKU原价优先
basePrice = new bignumber_js_1.BigNumber(goods.skuData?.salePrice ?? goods.salePrice ?? 0);
}
total = total.plus(basePrice.multipliedBy(availableNum));
total = total.plus(basePrice.multipliedBy(safeNum));
}

@@ -545,0 +548,0 @@ return truncateToTwoDecimals(total.toNumber());

{
"name": "ysk-utils",
"version": "1.0.85",
"version": "1.0.87",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",