Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/@formatjs/ecma402-abstract/NumberFormat/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InitializeNumberFormat = void 0;
var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList");
var _262_1 = require("../262");
var GetOption_1 = require("../GetOption");
var ResolveLocale_1 = require("../ResolveLocale");
var SetNumberFormatUnitOptions_1 = require("./SetNumberFormatUnitOptions");
var CurrencyDigits_1 = require("./CurrencyDigits");
var SetNumberFormatDigitOptions_1 = require("./SetNumberFormatDigitOptions");
var utils_1 = require("../utils");
/**
* Chop off the unicode extension from the locale string.
*/
function removeUnicodeExtensionFromLocale(canonicalLocale) {
var extensionIndex = canonicalLocale.indexOf('-u-');
return extensionIndex >= 0
? canonicalLocale.slice(0, extensionIndex)
: canonicalLocale;
}
/**
* https://tc39.es/ecma402/#sec-initializenumberformat
*/
function InitializeNumberFormat(nf, locales, opts, _a) {
var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, availableLocales = _a.availableLocales, numberingSystemNames = _a.numberingSystemNames, getDefaultLocale = _a.getDefaultLocale, currencyDigitsData = _a.currencyDigitsData;
// @ts-ignore
var requestedLocales = CanonicalizeLocaleList_1.CanonicalizeLocaleList(locales);
var options = opts === undefined ? Object.create(null) : _262_1.ToObject(opts);
var opt = Object.create(null);
var matcher = GetOption_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
opt.localeMatcher = matcher;
var numberingSystem = GetOption_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
if (numberingSystem !== undefined &&
numberingSystemNames.indexOf(numberingSystem) < 0) {
// 8.a. If numberingSystem does not match the Unicode Locale Identifier type nonterminal,
// throw a RangeError exception.
throw RangeError("Invalid numberingSystems: " + numberingSystem);
}
opt.nu = numberingSystem;
var r = ResolveLocale_1.ResolveLocale(availableLocales, requestedLocales, opt,
// [[RelevantExtensionKeys]] slot, which is a constant
['nu'], localeData, getDefaultLocale);
var dataLocaleData = localeData[removeUnicodeExtensionFromLocale(r.locale)];
utils_1.invariant(!!dataLocaleData, "Missing locale data for " + r.locale);
var internalSlots = getInternalSlots(nf);
internalSlots.locale = r.locale;
internalSlots.dataLocale = r.dataLocale;
internalSlots.numberingSystem = r.nu;
internalSlots.dataLocaleData = dataLocaleData;
SetNumberFormatUnitOptions_1.SetNumberFormatUnitOptions(nf, options, { getInternalSlots: getInternalSlots });
var style = internalSlots.style;
var mnfdDefault;
var mxfdDefault;
if (style === 'currency') {
var currency = internalSlots.currency;
var cDigits = CurrencyDigits_1.CurrencyDigits(currency, { currencyDigitsData: currencyDigitsData });
mnfdDefault = cDigits;
mxfdDefault = cDigits;
}
else {
mnfdDefault = 0;
mxfdDefault = style === 'percent' ? 0 : 3;
}
var notation = GetOption_1.GetOption(options, 'notation', 'string', ['standard', 'scientific', 'engineering', 'compact'], 'standard');
internalSlots.notation = notation;
SetNumberFormatDigitOptions_1.SetNumberFormatDigitOptions(internalSlots, options, mnfdDefault, mxfdDefault, notation);
var compactDisplay = GetOption_1.GetOption(options, 'compactDisplay', 'string', ['short', 'long'], 'short');
if (notation === 'compact') {
internalSlots.compactDisplay = compactDisplay;
}
var useGrouping = GetOption_1.GetOption(options, 'useGrouping', 'boolean', undefined, true);
internalSlots.useGrouping = useGrouping;
var signDisplay = GetOption_1.GetOption(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero'], 'auto');
internalSlots.signDisplay = signDisplay;
return nf;
}
exports.InitializeNumberFormat = InitializeNumberFormat;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0049 ]-- |