decord/source/13064_SetNumberFormatUnitOptions.js

49 lines
2 KiB
JavaScript
Raw Normal View History

2026-07-21 22:01:30 +00:00
// Module ID: 13064
// Function ID: 99357
2026-07-20 16:05:17 +00:00
// Name: SetNumberFormatUnitOptions
// Dependencies: []
2026-07-21 22:01:30 +00:00
// Module 13064 (SetNumberFormatUnitOptions)
2026-07-20 16:05:17 +00:00
arg5.SetNumberFormatUnitOptions = function SetNumberFormatUnitOptions(internalSlots, result1) {
let obj = result1;
if (undefined === result1) {
const _Object = Object;
obj = Object.create(null);
}
const GetOptionResult = result1(arg6[0]).GetOption(obj, "style", "string", [], "decimal");
internalSlots.style = GetOptionResult;
const str = result1(arg6[0]).GetOption(obj, "currency", "string", undefined, undefined);
let result = undefined === str;
if (!result) {
result = result1(arg6[2]).IsWellFormedCurrencyCode(str);
}
result1(arg6[1]).invariant(result, "Malformed currency code", RangeError);
let tmp10 = "currency" !== GetOptionResult;
if (!tmp10) {
tmp10 = undefined !== str;
}
result1(arg6[1]).invariant(tmp10, "currency cannot be undefined", TypeError);
2026-07-21 22:01:30 +00:00
const GetOptionResult1 = result1(arg6[0]).GetOption(obj, "currencyDisplay", "string", [], "symbol");
2026-07-20 16:05:17 +00:00
const GetOptionResult3 = result1(arg6[0]).GetOption(obj, "unit", "string", undefined, undefined);
result1 = undefined === GetOptionResult3;
if (!result1) {
result1 = result1(arg6[3]).IsWellFormedUnitIdentifier(GetOptionResult3);
}
result1(arg6[1]).invariant(result1, "Invalid unit argument for Intl.NumberFormat()", RangeError);
let tmp19 = "unit" !== GetOptionResult;
if (!tmp19) {
tmp19 = undefined !== GetOptionResult3;
}
result1(arg6[1]).invariant(tmp19, "unit cannot be undefined", TypeError);
2026-07-21 22:01:30 +00:00
const GetOptionResult2 = result1(arg6[0]).GetOption(obj, "currencySign", "string", [], "standard");
2026-07-20 16:05:17 +00:00
if ("currency" === GetOptionResult) {
internalSlots.currency = str.toUpperCase();
internalSlots.currencyDisplay = GetOptionResult1;
internalSlots.currencySign = GetOptionResult2;
}
if ("unit" === GetOptionResult) {
internalSlots.unit = GetOptionResult3;
internalSlots.unitDisplay = GetOptionResult4;
}
};