Socket
Socket
Sign inDemoInstall

@formatjs/ecma402-abstract

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/ecma402-abstract - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0

2

CoerceOptionsToObject.js

@@ -14,4 +14,4 @@ "use strict";

}
return _262_1.ToObject(options);
return (0, _262_1.ToObject)(options);
}
exports.CoerceOptionsToObject = CoerceOptionsToObject;

@@ -6,3 +6,3 @@ "use strict";

var MissingLocaleDataError = /** @class */ (function (_super) {
tslib_1.__extends(MissingLocaleDataError, _super);
(0, tslib_1.__extends)(MissingLocaleDataError, _super);
function MissingLocaleDataError() {

@@ -9,0 +9,0 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

@@ -8,3 +8,3 @@ "use strict";

if (isNaN(val) || val < min || val > max) {
throw new RangeError(val + " is outside of range [" + min + ", " + max + "]");
throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
}

@@ -11,0 +11,0 @@ return Math.floor(val);

@@ -16,4 +16,4 @@ "use strict";

// @ts-expect-error
return DefaultNumberOption_1.DefaultNumberOption(val, minimum, maximum, fallback);
return (0, DefaultNumberOption_1.DefaultNumberOption)(val, minimum, maximum, fallback);
}
exports.GetNumberOption = GetNumberOption;

@@ -26,6 +26,6 @@ "use strict";

if (type === 'string') {
value = _262_1.ToString(value);
value = (0, _262_1.ToString)(value);
}
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " is not within " + values.join(', '));
throw new RangeError("".concat(value, " is not within ").concat(values.join(', ')));
}

@@ -32,0 +32,0 @@ return value;

@@ -5,27 +5,27 @@ "use strict";

var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./CanonicalizeLocaleList"), exports);
tslib_1.__exportStar(require("./CanonicalizeTimeZoneName"), exports);
tslib_1.__exportStar(require("./CoerceOptionsToObject"), exports);
tslib_1.__exportStar(require("./GetNumberOption"), exports);
tslib_1.__exportStar(require("./GetOption"), exports);
tslib_1.__exportStar(require("./GetOptionsObject"), exports);
tslib_1.__exportStar(require("./IsSanctionedSimpleUnitIdentifier"), exports);
tslib_1.__exportStar(require("./IsValidTimeZoneName"), exports);
tslib_1.__exportStar(require("./IsWellFormedCurrencyCode"), exports);
tslib_1.__exportStar(require("./IsWellFormedUnitIdentifier"), exports);
tslib_1.__exportStar(require("./NumberFormat/ComputeExponent"), exports);
tslib_1.__exportStar(require("./NumberFormat/ComputeExponentForMagnitude"), exports);
tslib_1.__exportStar(require("./NumberFormat/CurrencyDigits"), exports);
tslib_1.__exportStar(require("./NumberFormat/FormatNumericToParts"), exports);
tslib_1.__exportStar(require("./NumberFormat/FormatNumericToString"), exports);
tslib_1.__exportStar(require("./NumberFormat/InitializeNumberFormat"), exports);
tslib_1.__exportStar(require("./NumberFormat/PartitionNumberPattern"), exports);
tslib_1.__exportStar(require("./NumberFormat/SetNumberFormatDigitOptions"), exports);
tslib_1.__exportStar(require("./NumberFormat/SetNumberFormatUnitOptions"), exports);
tslib_1.__exportStar(require("./NumberFormat/ToRawFixed"), exports);
tslib_1.__exportStar(require("./NumberFormat/ToRawPrecision"), exports);
(0, tslib_1.__exportStar)(require("./CanonicalizeLocaleList"), exports);
(0, tslib_1.__exportStar)(require("./CanonicalizeTimeZoneName"), exports);
(0, tslib_1.__exportStar)(require("./CoerceOptionsToObject"), exports);
(0, tslib_1.__exportStar)(require("./GetNumberOption"), exports);
(0, tslib_1.__exportStar)(require("./GetOption"), exports);
(0, tslib_1.__exportStar)(require("./GetOptionsObject"), exports);
(0, tslib_1.__exportStar)(require("./IsSanctionedSimpleUnitIdentifier"), exports);
(0, tslib_1.__exportStar)(require("./IsValidTimeZoneName"), exports);
(0, tslib_1.__exportStar)(require("./IsWellFormedCurrencyCode"), exports);
(0, tslib_1.__exportStar)(require("./IsWellFormedUnitIdentifier"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/ComputeExponent"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/ComputeExponentForMagnitude"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/CurrencyDigits"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/FormatNumericToParts"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/FormatNumericToString"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/InitializeNumberFormat"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/PartitionNumberPattern"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/SetNumberFormatDigitOptions"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/SetNumberFormatUnitOptions"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/ToRawFixed"), exports);
(0, tslib_1.__exportStar)(require("./NumberFormat/ToRawPrecision"), exports);
var format_to_parts_1 = require("./NumberFormat/format_to_parts");
Object.defineProperty(exports, "_formatToParts", { enumerable: true, get: function () { return tslib_1.__importDefault(format_to_parts_1).default; } });
tslib_1.__exportStar(require("./PartitionPattern"), exports);
tslib_1.__exportStar(require("./SupportedLocales"), exports);
Object.defineProperty(exports, "_formatToParts", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(format_to_parts_1).default; } });
(0, tslib_1.__exportStar)(require("./PartitionPattern"), exports);
(0, tslib_1.__exportStar)(require("./SupportedLocales"), exports);
var utils_1 = require("./utils");

@@ -41,10 +41,10 @@ Object.defineProperty(exports, "getInternalSlot", { enumerable: true, get: function () { return utils_1.getInternalSlot; } });

Object.defineProperty(exports, "isMissingLocaleDataError", { enumerable: true, get: function () { return data_1.isMissingLocaleDataError; } });
tslib_1.__exportStar(require("./types/relative-time"), exports);
tslib_1.__exportStar(require("./types/date-time"), exports);
tslib_1.__exportStar(require("./types/list"), exports);
tslib_1.__exportStar(require("./types/plural-rules"), exports);
tslib_1.__exportStar(require("./types/number"), exports);
tslib_1.__exportStar(require("./types/displaynames"), exports);
(0, tslib_1.__exportStar)(require("./types/relative-time"), exports);
(0, tslib_1.__exportStar)(require("./types/date-time"), exports);
(0, tslib_1.__exportStar)(require("./types/list"), exports);
(0, tslib_1.__exportStar)(require("./types/plural-rules"), exports);
(0, tslib_1.__exportStar)(require("./types/number"), exports);
(0, tslib_1.__exportStar)(require("./types/displaynames"), exports);
var utils_2 = require("./utils");
Object.defineProperty(exports, "invariant", { enumerable: true, get: function () { return utils_2.invariant; } });
tslib_1.__exportStar(require("./262"), exports);
(0, tslib_1.__exportStar)(require("./262"), exports);

@@ -18,3 +18,3 @@ "use strict";

unit = toLowerCase(unit);
if (IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier(unit)) {
if ((0, IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier)(unit)) {
return true;

@@ -27,4 +27,4 @@ }

var numerator = units[0], denominator = units[1];
if (!IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier(numerator) ||
!IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier(denominator)) {
if (!(0, IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier)(numerator) ||
!(0, IsSanctionedSimpleUnitIdentifier_1.IsSanctionedSimpleUnitIdentifier)(denominator)) {
return false;

@@ -31,0 +31,0 @@ }

@@ -5,3 +5,3 @@ export function DefaultNumberOption(val, min, max, fallback) {

if (isNaN(val) || val < min || val > max) {
throw new RangeError(val + " is outside of range [" + min + ", " + max + "]");
throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
}

@@ -8,0 +8,0 @@ return Math.floor(val);

@@ -26,3 +26,3 @@ import { ToString } from './262';

if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " is not within " + values.join(', '));
throw new RangeError("".concat(value, " is not within ").concat(values.join(', ')));
}

@@ -29,0 +29,0 @@ return value;

@@ -7,5 +7,5 @@ import { ToRawFixed } from './ToRawFixed';

// /^\p{S}/u
var CARET_S_UNICODE_REGEX = new RegExp("^" + S_UNICODE_REGEX.source);
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
// /\p{S}$/u
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source + "$");
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;

@@ -99,7 +99,7 @@ export default function formatToParts(numberResult, data, pl, options) {

if (afterCurrency && !S_DOLLAR_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('¤{0}', "\u00A4" + afterCurrency + "{0}");
numberPattern = numberPattern.replace('¤{0}', "\u00A4".concat(afterCurrency, "{0}"));
}
var beforeCurrency = currencyData.currencySpacing.beforeInsertBetween;
if (beforeCurrency && !CARET_S_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('{0}¤', "{0}" + beforeCurrency + "\u00A4");
numberPattern = numberPattern.replace('{0}¤', "{0}".concat(beforeCurrency, "\u00A4"));
}

@@ -360,3 +360,3 @@ }

if (pattern.indexOf(';') < 0) {
pattern = pattern + ";-" + pattern;
pattern = "".concat(pattern, ";-").concat(pattern);
}

@@ -372,3 +372,3 @@ var _a = pattern.split(';'), zeroPattern = _a[0], negativePattern = _a[1];

? negativePattern.replace(/-/g, '+')
: "+" + zeroPattern;
: "+".concat(zeroPattern);
}

@@ -375,0 +375,0 @@ }

@@ -25,3 +25,3 @@ import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList';

// throw a RangeError exception.
throw RangeError("Invalid numberingSystems: " + numberingSystem);
throw RangeError("Invalid numberingSystems: ".concat(numberingSystem));
}

@@ -33,3 +33,3 @@ opt.nu = numberingSystem;

var dataLocaleData = localeData[r.dataLocale];
invariant(!!dataLocaleData, "Missing locale data for " + r.dataLocale);
invariant(!!dataLocaleData, "Missing locale data for ".concat(r.dataLocale));
var internalSlots = getInternalSlots(nf);

@@ -36,0 +36,0 @@ internalSlots.locale = r.locale;

@@ -36,3 +36,3 @@ import { repeat } from '../utils';

var b = m.slice(k - f);
m = a + "." + b;
m = "".concat(a, ".").concat(b);
int = a.length;

@@ -39,0 +39,0 @@ }

@@ -52,7 +52,7 @@ import { repeat, getMagnitude } from '../utils';

else if (e >= 0) {
m = m.slice(0, e + 1) + "." + m.slice(e + 1);
m = "".concat(m.slice(0, e + 1), ".").concat(m.slice(e + 1));
int = e + 1;
}
else {
m = "0." + repeat('0', -e - 1) + m;
m = "0.".concat(repeat('0', -e - 1)).concat(m);
int = 1;

@@ -59,0 +59,0 @@ }

@@ -14,3 +14,3 @@ import { invariant } from './utils';

endIndex = pattern.indexOf('}', beginIndex);
invariant(endIndex > beginIndex, "Invalid pattern " + pattern);
invariant(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
if (beginIndex > nextIndex) {

@@ -17,0 +17,0 @@ result.push({

@@ -1,2 +0,3 @@

export declare type Formats = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName' | 'fractionalSecondDigits'> & {
export declare type Formats = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
fractionalSecondDigits?: 0 | 1 | 2;
hour12?: boolean;

@@ -112,3 +113,3 @@ pattern: string;

} & Record<string, Record<string, string>>;
export interface DateTimeFormat extends Intl.DateTimeFormat {
export interface DateTimeFormat extends Omit<Intl.DateTimeFormat, 'resolvedOptions'> {
resolvedOptions(): ResolvedDateTimeFormatOptions;

@@ -121,3 +122,2 @@ formatRange(startDate: number | Date, endDate: number | Date): string;

timeStyle?: 'full' | 'long' | 'medium' | 'short';
hourCycle: string;
numberingSystem: string;

@@ -124,0 +124,0 @@ }

@@ -127,3 +127,3 @@ import { LDMLPluralRule } from './plural-rules';

}
export declare type NumberFormatOptions = Intl.NumberFormatOptions & NumberFormatDigitOptions & {
export declare type NumberFormatOptions = Omit<Intl.NumberFormatOptions, 'signDisplay'> & NumberFormatDigitOptions & {
localeMatcher?: NumberFormatOptionsLocaleMatcher;

@@ -130,0 +130,0 @@ style?: NumberFormatOptionsStyle;

@@ -43,3 +43,3 @@ /**

if (!slots) {
throw new TypeError(pl + " InternalSlot has not been initialized");
throw new TypeError("".concat(pl, " InternalSlot has not been initialized"));
}

@@ -46,0 +46,0 @@ return fields.reduce(function (all, f) {

@@ -22,4 +22,4 @@ "use strict";

}
var magnitude = utils_1.getMagnitude(x);
var exponent = ComputeExponentForMagnitude_1.ComputeExponentForMagnitude(numberFormat, magnitude, {
var magnitude = (0, utils_1.getMagnitude)(x);
var exponent = (0, ComputeExponentForMagnitude_1.ComputeExponentForMagnitude)(numberFormat, magnitude, {
getInternalSlots: getInternalSlots,

@@ -29,7 +29,7 @@ });

x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
var formatNumberResult = FormatNumericToString_1.FormatNumericToString(getInternalSlots(numberFormat), x);
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(getInternalSlots(numberFormat), x);
if (formatNumberResult.roundedNumber === 0) {
return [exponent, magnitude];
}
var newMagnitude = utils_1.getMagnitude(formatNumberResult.roundedNumber);
var newMagnitude = (0, utils_1.getMagnitude)(formatNumberResult.roundedNumber);
if (newMagnitude === magnitude - exponent) {

@@ -39,3 +39,3 @@ return [exponent, magnitude];

return [
ComputeExponentForMagnitude_1.ComputeExponentForMagnitude(numberFormat, magnitude + 1, {
(0, ComputeExponentForMagnitude_1.ComputeExponentForMagnitude)(numberFormat, magnitude + 1, {
getInternalSlots: getInternalSlots,

@@ -42,0 +42,0 @@ }),

@@ -10,3 +10,3 @@ "use strict";

var currencyDigitsData = _a.currencyDigitsData;
return _262_1.HasOwnProperty(currencyDigitsData, c)
return (0, _262_1.HasOwnProperty)(currencyDigitsData, c)
? currencyDigitsData[c]

@@ -13,0 +13,0 @@ : 2;

@@ -9,5 +9,5 @@ "use strict";

// /^\p{S}/u
var CARET_S_UNICODE_REGEX = new RegExp("^" + regex_generated_1.S_UNICODE_REGEX.source);
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(regex_generated_1.S_UNICODE_REGEX.source));
// /\p{S}$/u
var S_DOLLAR_UNICODE_REGEX = new RegExp(regex_generated_1.S_UNICODE_REGEX.source + "$");
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(regex_generated_1.S_UNICODE_REGEX.source, "$"));
var CLDR_NUMBER_PATTERN = /[#0](?:[\.,][#0]+)*/g;

@@ -101,7 +101,7 @@ function formatToParts(numberResult, data, pl, options) {

if (afterCurrency && !S_DOLLAR_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('¤{0}', "\u00A4" + afterCurrency + "{0}");
numberPattern = numberPattern.replace('¤{0}', "\u00A4".concat(afterCurrency, "{0}"));
}
var beforeCurrency = currencyData.currencySpacing.beforeInsertBetween;
if (beforeCurrency && !CARET_S_UNICODE_REGEX.test(nonNameCurrencyPart)) {
numberPattern = numberPattern.replace('{0}¤', "{0}" + beforeCurrency + "\u00A4");
numberPattern = numberPattern.replace('{0}¤', "{0}".concat(beforeCurrency, "\u00A4"));
}

@@ -353,3 +353,3 @@ }

}
var exponentResult = ToRawFixed_1.ToRawFixed(exponent, 0, 0);
var exponentResult = (0, ToRawFixed_1.ToRawFixed)(exponent, 0, 0);
result.push({

@@ -364,3 +364,3 @@ type: 'exponentInteger',

if (pattern.indexOf(';') < 0) {
pattern = pattern + ";-" + pattern;
pattern = "".concat(pattern, ";-").concat(pattern);
}

@@ -376,3 +376,3 @@ var _a = pattern.split(';'), zeroPattern = _a[0], negativePattern = _a[1];

? negativePattern.replace(/-/g, '+')
: "+" + zeroPattern;
: "+".concat(zeroPattern);
}

@@ -379,0 +379,0 @@ }

@@ -7,4 +7,4 @@ "use strict";

function FormatNumericToParts(nf, x, implDetails) {
var parts = PartitionNumberPattern_1.PartitionNumberPattern(nf, x, implDetails);
var result = _262_1.ArrayCreate(0);
var parts = (0, PartitionNumberPattern_1.PartitionNumberPattern)(nf, x, implDetails);
var result = (0, _262_1.ArrayCreate)(0);
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {

@@ -11,0 +11,0 @@ var part = parts_1[_i];

@@ -12,3 +12,3 @@ "use strict";

function FormatNumericToString(intlObject, x) {
var isNegative = x < 0 || _262_1.SameValue(x, -0);
var isNegative = x < 0 || (0, _262_1.SameValue)(x, -0);
if (isNegative) {

@@ -21,11 +21,11 @@ x = -x;

case 'significantDigits':
result = ToRawPrecision_1.ToRawPrecision(x, intlObject.minimumSignificantDigits, intlObject.maximumSignificantDigits);
result = (0, ToRawPrecision_1.ToRawPrecision)(x, intlObject.minimumSignificantDigits, intlObject.maximumSignificantDigits);
break;
case 'fractionDigits':
result = ToRawFixed_1.ToRawFixed(x, intlObject.minimumFractionDigits, intlObject.maximumFractionDigits);
result = (0, ToRawFixed_1.ToRawFixed)(x, intlObject.minimumFractionDigits, intlObject.maximumFractionDigits);
break;
default:
result = ToRawPrecision_1.ToRawPrecision(x, 1, 2);
result = (0, ToRawPrecision_1.ToRawPrecision)(x, 1, 2);
if (result.integerDigitsCount > 1) {
result = ToRawFixed_1.ToRawFixed(x, 0, 0);
result = (0, ToRawFixed_1.ToRawFixed)(x, 0, 0);
}

@@ -39,3 +39,3 @@ break;

if (int < minInteger) {
var forwardZeros = utils_1.repeat('0', minInteger - int);
var forwardZeros = (0, utils_1.repeat)('0', minInteger - int);
string = forwardZeros + string;

@@ -42,0 +42,0 @@ }

@@ -18,8 +18,8 @@ "use strict";

// @ts-ignore
var requestedLocales = CanonicalizeLocaleList_1.CanonicalizeLocaleList(locales);
var options = CoerceOptionsToObject_1.CoerceOptionsToObject(opts);
var requestedLocales = (0, CanonicalizeLocaleList_1.CanonicalizeLocaleList)(locales);
var options = (0, CoerceOptionsToObject_1.CoerceOptionsToObject)(opts);
var opt = Object.create(null);
var matcher = GetOption_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
var matcher = (0, GetOption_1.GetOption)(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
opt.localeMatcher = matcher;
var numberingSystem = GetOption_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);
var numberingSystem = (0, GetOption_1.GetOption)(options, 'numberingSystem', 'string', undefined, undefined);
if (numberingSystem !== undefined &&

@@ -29,10 +29,10 @@ numberingSystemNames.indexOf(numberingSystem) < 0) {

// throw a RangeError exception.
throw RangeError("Invalid numberingSystems: " + numberingSystem);
throw RangeError("Invalid numberingSystems: ".concat(numberingSystem));
}
opt.nu = numberingSystem;
var r = intl_localematcher_1.ResolveLocale(availableLocales, requestedLocales, opt,
var r = (0, intl_localematcher_1.ResolveLocale)(availableLocales, requestedLocales, opt,
// [[RelevantExtensionKeys]] slot, which is a constant
['nu'], localeData, getDefaultLocale);
var dataLocaleData = localeData[r.dataLocale];
utils_1.invariant(!!dataLocaleData, "Missing locale data for " + r.dataLocale);
(0, utils_1.invariant)(!!dataLocaleData, "Missing locale data for ".concat(r.dataLocale));
var internalSlots = getInternalSlots(nf);

@@ -43,3 +43,3 @@ internalSlots.locale = r.locale;

internalSlots.dataLocaleData = dataLocaleData;
SetNumberFormatUnitOptions_1.SetNumberFormatUnitOptions(nf, options, { getInternalSlots: getInternalSlots });
(0, SetNumberFormatUnitOptions_1.SetNumberFormatUnitOptions)(nf, options, { getInternalSlots: getInternalSlots });
var style = internalSlots.style;

@@ -50,3 +50,3 @@ var mnfdDefault;

var currency = internalSlots.currency;
var cDigits = CurrencyDigits_1.CurrencyDigits(currency, { currencyDigitsData: currencyDigitsData });
var cDigits = (0, CurrencyDigits_1.CurrencyDigits)(currency, { currencyDigitsData: currencyDigitsData });
mnfdDefault = cDigits;

@@ -59,12 +59,12 @@ mxfdDefault = cDigits;

}
var notation = GetOption_1.GetOption(options, 'notation', 'string', ['standard', 'scientific', 'engineering', 'compact'], 'standard');
var notation = (0, 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');
(0, SetNumberFormatDigitOptions_1.SetNumberFormatDigitOptions)(internalSlots, options, mnfdDefault, mxfdDefault, notation);
var compactDisplay = (0, 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);
var useGrouping = (0, GetOption_1.GetOption)(options, 'useGrouping', 'boolean', undefined, true);
internalSlots.useGrouping = useGrouping;
var signDisplay = GetOption_1.GetOption(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero'], 'auto');
var signDisplay = (0, GetOption_1.GetOption)(options, 'signDisplay', 'string', ['auto', 'never', 'always', 'exceptZero'], 'auto');
internalSlots.signDisplay = signDisplay;

@@ -71,0 +71,0 @@ return nf;

@@ -8,3 +8,3 @@ "use strict";

var ComputeExponent_1 = require("./ComputeExponent");
var format_to_parts_1 = tslib_1.__importDefault(require("./format_to_parts"));
var format_to_parts_1 = (0, tslib_1.__importDefault)(require("./format_to_parts"));
/**

@@ -34,3 +34,3 @@ * https://tc39.es/ecma402/#sec-formatnumberstring

;
_b = ComputeExponent_1.ComputeExponent(numberFormat, x, {
_b = (0, ComputeExponent_1.ComputeExponent)(numberFormat, x, {
getInternalSlots: getInternalSlots,

@@ -40,3 +40,3 @@ }), exponent = _b[0], magnitude = _b[1];

x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
var formatNumberResult = FormatNumericToString_1.FormatNumericToString(internalSlots, x);
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(internalSlots, x);
n = formatNumberResult.formattedString;

@@ -54,3 +54,3 @@ x = formatNumberResult.roundedNumber;

case 'auto':
if (_262_1.SameValue(x, 0) || x > 0 || isNaN(x)) {
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
sign = 0;

@@ -63,3 +63,3 @@ }

case 'always':
if (_262_1.SameValue(x, 0) || x > 0 || isNaN(x)) {
if ((0, _262_1.SameValue)(x, 0) || x > 0 || isNaN(x)) {
sign = 1;

@@ -83,4 +83,4 @@ }

}
return format_to_parts_1.default({ roundedNumber: x, formattedString: n, exponent: exponent, magnitude: magnitude, sign: sign }, internalSlots.dataLocaleData, pl, internalSlots);
return (0, format_to_parts_1.default)({ roundedNumber: x, formattedString: n, exponent: exponent, magnitude: magnitude, sign: sign }, internalSlots.dataLocaleData, pl, internalSlots);
}
exports.PartitionNumberPattern = PartitionNumberPattern;

@@ -10,3 +10,3 @@ "use strict";

function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefault, notation) {
var mnid = GetNumberOption_1.GetNumberOption(opts, 'minimumIntegerDigits', 1, 21, 1);
var mnid = (0, GetNumberOption_1.GetNumberOption)(opts, 'minimumIntegerDigits', 1, 21, 1);
var mnfd = opts.minimumFractionDigits;

@@ -19,4 +19,4 @@ var mxfd = opts.maximumFractionDigits;

internalSlots.roundingType = 'significantDigits';
mnsd = DefaultNumberOption_1.DefaultNumberOption(mnsd, 1, 21, 1);
mxsd = DefaultNumberOption_1.DefaultNumberOption(mxsd, mnsd, 21, 21);
mnsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnsd, 1, 21, 1);
mxsd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxsd, mnsd, 21, 21);
internalSlots.minimumSignificantDigits = mnsd;

@@ -27,5 +27,5 @@ internalSlots.maximumSignificantDigits = mxsd;

internalSlots.roundingType = 'fractionDigits';
mnfd = DefaultNumberOption_1.DefaultNumberOption(mnfd, 0, 20, mnfdDefault);
mnfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mnfd, 0, 20, mnfdDefault);
var mxfdActualDefault = Math.max(mnfd, mxfdDefault);
mxfd = DefaultNumberOption_1.DefaultNumberOption(mxfd, mnfd, 20, mxfdActualDefault);
mxfd = (0, DefaultNumberOption_1.DefaultNumberOption)(mxfd, mnfd, 20, mxfdActualDefault);
internalSlots.minimumFractionDigits = mnfd;

@@ -32,0 +32,0 @@ internalSlots.maximumFractionDigits = mxfd;

@@ -14,6 +14,6 @@ "use strict";

var internalSlots = getInternalSlots(nf);
var style = GetOption_1.GetOption(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
var style = (0, GetOption_1.GetOption)(options, 'style', 'string', ['decimal', 'percent', 'currency', 'unit'], 'decimal');
internalSlots.style = style;
var currency = GetOption_1.GetOption(options, 'currency', 'string', undefined, undefined);
if (currency !== undefined && !IsWellFormedCurrencyCode_1.IsWellFormedCurrencyCode(currency)) {
var currency = (0, GetOption_1.GetOption)(options, 'currency', 'string', undefined, undefined);
if (currency !== undefined && !(0, IsWellFormedCurrencyCode_1.IsWellFormedCurrencyCode)(currency)) {
throw RangeError('Malformed currency code');

@@ -24,6 +24,6 @@ }

}
var currencyDisplay = GetOption_1.GetOption(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
var currencySign = GetOption_1.GetOption(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
var unit = GetOption_1.GetOption(options, 'unit', 'string', undefined, undefined);
if (unit !== undefined && !IsWellFormedUnitIdentifier_1.IsWellFormedUnitIdentifier(unit)) {
var currencyDisplay = (0, GetOption_1.GetOption)(options, 'currencyDisplay', 'string', ['code', 'symbol', 'narrowSymbol', 'name'], 'symbol');
var currencySign = (0, GetOption_1.GetOption)(options, 'currencySign', 'string', ['standard', 'accounting'], 'standard');
var unit = (0, GetOption_1.GetOption)(options, 'unit', 'string', undefined, undefined);
if (unit !== undefined && !(0, IsWellFormedUnitIdentifier_1.IsWellFormedUnitIdentifier)(unit)) {
throw RangeError('Invalid unit argument for Intl.NumberFormat()');

@@ -34,3 +34,3 @@ }

}
var unitDisplay = GetOption_1.GetOption(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
var unitDisplay = (0, GetOption_1.GetOption)(options, 'unitDisplay', 'string', ['short', 'narrow', 'long'], 'short');
if (style === 'currency') {

@@ -37,0 +37,0 @@ internalSlots.currency = currency.toUpperCase();

@@ -27,3 +27,3 @@ "use strict";

m = mantissa.replace('.', '');
m = m + utils_1.repeat('0', Math.max(+exponent - m.length + 1, 0));
m = m + (0, utils_1.repeat)('0', Math.max(+exponent - m.length + 1, 0));
}

@@ -34,3 +34,3 @@ var int;

if (k <= f) {
var z = utils_1.repeat('0', f + 1 - k);
var z = (0, utils_1.repeat)('0', f + 1 - k);
m = z + m;

@@ -41,3 +41,3 @@ k = f + 1;

var b = m.slice(k - f);
m = a + "." + b;
m = "".concat(a, ".").concat(b);
int = a.length;

@@ -44,0 +44,0 @@ }

@@ -11,3 +11,3 @@ "use strict";

if (x === 0) {
m = utils_1.repeat('0', p);
m = (0, utils_1.repeat)('0', p);
e = 0;

@@ -30,7 +30,7 @@ xFinal = 0;

xToStringMantissaWithoutDecimalPoint +
utils_1.repeat('0', p - xToStringMantissaWithoutDecimalPoint.length);
(0, utils_1.repeat)('0', p - xToStringMantissaWithoutDecimalPoint.length);
xFinal = x;
}
else {
e = utils_1.getMagnitude(x);
e = (0, utils_1.getMagnitude)(x);
var decimalPlaceOffset = e - p + 1;

@@ -53,11 +53,11 @@ // n is the integer containing the required precision digits. To derive the formatted string,

if (e >= p - 1) {
m = m + utils_1.repeat('0', e - p + 1);
m = m + (0, utils_1.repeat)('0', e - p + 1);
int = e + 1;
}
else if (e >= 0) {
m = m.slice(0, e + 1) + "." + m.slice(e + 1);
m = "".concat(m.slice(0, e + 1), ".").concat(m.slice(e + 1));
int = e + 1;
}
else {
m = "0." + utils_1.repeat('0', -e - 1) + m;
m = "0.".concat((0, utils_1.repeat)('0', -e - 1)).concat(m);
int = 1;

@@ -64,0 +64,0 @@ }

{
"name": "@formatjs/ecma402-abstract",
"version": "1.10.0",
"version": "1.11.0",
"description": "A collection of implementation for ECMAScript abstract operations",

@@ -5,0 +5,0 @@ "keywords": [

@@ -17,3 +17,3 @@ "use strict";

endIndex = pattern.indexOf('}', beginIndex);
utils_1.invariant(endIndex > beginIndex, "Invalid pattern " + pattern);
(0, utils_1.invariant)(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
if (beginIndex > nextIndex) {

@@ -20,0 +20,0 @@ result.push({

@@ -16,10 +16,10 @@ "use strict";

if (options !== undefined) {
options = _262_1.ToObject(options);
matcher = GetOption_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
options = (0, _262_1.ToObject)(options);
matcher = (0, GetOption_1.GetOption)(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');
}
if (matcher === 'best fit') {
return intl_localematcher_1.LookupSupportedLocales(availableLocales, requestedLocales);
return (0, intl_localematcher_1.LookupSupportedLocales)(availableLocales, requestedLocales);
}
return intl_localematcher_1.LookupSupportedLocales(availableLocales, requestedLocales);
return (0, intl_localematcher_1.LookupSupportedLocales)(availableLocales, requestedLocales);
}
exports.SupportedLocales = SupportedLocales;

@@ -1,2 +0,3 @@

export declare type Formats = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName' | 'fractionalSecondDigits'> & {
export declare type Formats = Pick<Intl.DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
fractionalSecondDigits?: 0 | 1 | 2;
hour12?: boolean;

@@ -112,3 +113,3 @@ pattern: string;

} & Record<string, Record<string, string>>;
export interface DateTimeFormat extends Intl.DateTimeFormat {
export interface DateTimeFormat extends Omit<Intl.DateTimeFormat, 'resolvedOptions'> {
resolvedOptions(): ResolvedDateTimeFormatOptions;

@@ -121,3 +122,2 @@ formatRange(startDate: number | Date, endDate: number | Date): string;

timeStyle?: 'full' | 'long' | 'medium' | 'short';
hourCycle: string;
numberingSystem: string;

@@ -124,0 +124,0 @@ }

@@ -127,3 +127,3 @@ import { LDMLPluralRule } from './plural-rules';

}
export declare type NumberFormatOptions = Intl.NumberFormatOptions & NumberFormatDigitOptions & {
export declare type NumberFormatOptions = Omit<Intl.NumberFormatOptions, 'signDisplay'> & NumberFormatDigitOptions & {
localeMatcher?: NumberFormatOptionsLocaleMatcher;

@@ -130,0 +130,0 @@ style?: NumberFormatOptionsStyle;

@@ -51,3 +51,3 @@ "use strict";

if (!slots) {
throw new TypeError(pl + " InternalSlot has not been initialized");
throw new TypeError("".concat(pl, " InternalSlot has not been initialized"));
}

@@ -54,0 +54,0 @@ return fields.reduce(function (all, f) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc