Files
klz-cables.com/.pnpm-store/v10/files/47/507eb90dcd8a0f6587c71354580cd4de764f5fea32ab64c80560e0c15551cb096ec018cfd6044ef04424e57e38c15289fb1b909b67f70fce11359d83c3663d
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

44 lines
1.7 KiB
Plaintext

import "../types/number.js";
import { invariant } from "../utils.js";
import { CollapseNumberRange } from "./CollapseNumberRange.js";
import { FormatApproximately } from "./FormatApproximately.js";
import { FormatNumeric } from "./FormatNumeric.js";
import { PartitionNumberPattern } from "./PartitionNumberPattern.js";
/**
* https://tc39.es/ecma402/#sec-partitionnumberrangepattern
*/
export function PartitionNumberRangePattern(numberFormat, x, y, { getInternalSlots }) {
// 1. Assert: x and y are both mathematical values.
invariant(!x.isNaN() && !y.isNaN(), "Input must be a number", RangeError);
const internalSlots = getInternalSlots(numberFormat);
// 3. Let xResult be ? PartitionNumberPattern(numberFormat, x).
const xResult = PartitionNumberPattern(internalSlots, x);
// 4. Let yResult be ? PartitionNumberPattern(numberFormat, y).
const yResult = PartitionNumberPattern(internalSlots, y);
if (FormatNumeric(internalSlots, x) === FormatNumeric(internalSlots, y)) {
const appxResult = FormatApproximately(internalSlots, xResult);
appxResult.forEach((el) => {
el.source = "shared";
});
return appxResult;
}
let result = [];
xResult.forEach((el) => {
el.source = "startRange";
result.push(el);
});
// 9. Let symbols be internalSlots.[[dataLocaleData]].[[numbers]].[[symbols]][internalSlots.[[numberingSystem]]].
const rangeSeparator = internalSlots.dataLocaleData.numbers.symbols[internalSlots.numberingSystem].rangeSign;
result.push({
type: "literal",
value: rangeSeparator,
source: "shared"
});
yResult.forEach((el) => {
el.source = "endRange";
result.push(el);
});
// 13. Return ? CollapseNumberRange(numberFormat, result).
return CollapseNumberRange(numberFormat, result, { getInternalSlots });
}