Files
klz-cables.com/.pnpm-store/v10/files/68/089065672e0c4406cdca53f7a80aa6c70a4d2a264d39e41d0c10303077e01be1fe70f6760393f3379bff901b3e5f9e3e98852f2e531ed04f354dfab5cf2ea5
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

34 lines
939 B
Plaintext

import { Decimal } from "decimal.js";
import { ToPrimitive } from "./262.js";
/**
* https://tc39.es/ecma402/#sec-tointlmathematicalvalue
* Converts input to a mathematical value, supporting BigInt
*/
export function ToIntlMathematicalValue(input) {
// Handle BigInt directly before ToPrimitive, since ToPrimitive doesn't
// handle bigint in its type signature (though the spec says it should return it as-is)
if (typeof input === "bigint") {
return new Decimal(input.toString());
}
let primValue = ToPrimitive(input, "number");
// Handle other primitive types
if (primValue === undefined) {
return new Decimal(NaN);
}
if (primValue === true) {
return new Decimal(1);
}
if (primValue === false) {
return new Decimal(0);
}
if (primValue === null) {
return new Decimal(0);
}
// Try to convert to Decimal (handles numbers and strings)
try {
return new Decimal(primValue);
} catch {
return new Decimal(NaN);
}
}