@formatjs/ecma402-abstract
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -31,5 +31,3 @@ "use strict"; | ||
} | ||
offsetStr = pattern | ||
.replace(/H+/, String(hours)) | ||
.replace(/m+/, String(mins)); | ||
offsetStr = pattern.replace(/H+/, String(hours)).replace(/m+/, String(mins)); | ||
} | ||
@@ -36,0 +34,0 @@ return gmtFormat.replace('{0}', offsetStr); |
@@ -18,2 +18,3 @@ "use strict"; | ||
if (i === zoneData.length || zoneData[i][0] * 1e3 > t) { | ||
; | ||
_a = zoneData[i - 1], offset = _a[2], dst = _a[3]; | ||
@@ -20,0 +21,0 @@ break; |
@@ -14,3 +14,5 @@ "use strict"; | ||
function GetOption(opts, prop, type, values, fallback) { | ||
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop); | ||
if (typeof opts !== 'object') { | ||
throw new TypeError('Options must be an object'); | ||
} | ||
var value = opts[prop]; | ||
@@ -17,0 +19,0 @@ if (value !== undefined) { |
export { BestFitFormatMatcher } from './DateTimeFormat/BestFitFormatMatcher'; | ||
export * from './CanonicalizeLocaleList'; | ||
export * from './CanonicalizeTimeZoneName'; | ||
export * from './CoerceOptionsToObject'; | ||
export * from './DateTimeFormat/BasicFormatMatcher'; | ||
@@ -16,2 +17,3 @@ export * from './DateTimeFormat/DateTimeStyleFormat'; | ||
export * from './GetOption'; | ||
export * from './GetOptionsObject'; | ||
export * from './IsSanctionedSimpleUnitIdentifier'; | ||
@@ -18,0 +20,0 @@ export * from './IsValidTimeZoneName'; |
@@ -9,2 +9,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./CanonicalizeTimeZoneName"), exports); | ||
tslib_1.__exportStar(require("./CoerceOptionsToObject"), exports); | ||
tslib_1.__exportStar(require("./DateTimeFormat/BasicFormatMatcher"), exports); | ||
@@ -22,2 +23,3 @@ tslib_1.__exportStar(require("./DateTimeFormat/DateTimeStyleFormat"), exports); | ||
tslib_1.__exportStar(require("./GetOption"), exports); | ||
tslib_1.__exportStar(require("./GetOptionsObject"), exports); | ||
tslib_1.__exportStar(require("./IsSanctionedSimpleUnitIdentifier"), exports); | ||
@@ -24,0 +26,0 @@ tslib_1.__exportStar(require("./IsValidTimeZoneName"), exports); |
@@ -28,5 +28,3 @@ import { DATE_TIME_PROPS } from './utils'; | ||
} | ||
offsetStr = pattern | ||
.replace(/H+/, String(hours)) | ||
.replace(/m+/, String(mins)); | ||
offsetStr = pattern.replace(/H+/, String(hours)).replace(/m+/, String(mins)); | ||
} | ||
@@ -33,0 +31,0 @@ return gmtFormat.replace('{0}', offsetStr); |
@@ -15,2 +15,3 @@ import { invariant } from '../utils'; | ||
if (i === zoneData.length || zoneData[i][0] * 1e3 > t) { | ||
; | ||
_a = zoneData[i - 1], offset = _a[2], dst = _a[3]; | ||
@@ -17,0 +18,0 @@ break; |
@@ -11,3 +11,5 @@ import { ToString } from './262'; | ||
export function GetOption(opts, prop, type, values, fallback) { | ||
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop); | ||
if (typeof opts !== 'object') { | ||
throw new TypeError('Options must be an object'); | ||
} | ||
var value = opts[prop]; | ||
@@ -14,0 +16,0 @@ if (value !== undefined) { |
export { BestFitFormatMatcher } from './DateTimeFormat/BestFitFormatMatcher'; | ||
export * from './CanonicalizeLocaleList'; | ||
export * from './CanonicalizeTimeZoneName'; | ||
export * from './CoerceOptionsToObject'; | ||
export * from './DateTimeFormat/BasicFormatMatcher'; | ||
@@ -16,2 +17,3 @@ export * from './DateTimeFormat/DateTimeStyleFormat'; | ||
export * from './GetOption'; | ||
export * from './GetOptionsObject'; | ||
export * from './IsSanctionedSimpleUnitIdentifier'; | ||
@@ -18,0 +20,0 @@ export * from './IsValidTimeZoneName'; |
export { BestFitFormatMatcher } from './DateTimeFormat/BestFitFormatMatcher'; | ||
export * from './CanonicalizeLocaleList'; | ||
export * from './CanonicalizeTimeZoneName'; | ||
export * from './CoerceOptionsToObject'; | ||
export * from './DateTimeFormat/BasicFormatMatcher'; | ||
@@ -16,2 +17,3 @@ export * from './DateTimeFormat/DateTimeStyleFormat'; | ||
export * from './GetOption'; | ||
export * from './GetOptionsObject'; | ||
export * from './IsSanctionedSimpleUnitIdentifier'; | ||
@@ -18,0 +20,0 @@ export * from './IsValidTimeZoneName'; |
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList'; | ||
import { ToObject } from '../262'; | ||
import { GetOption } from '../GetOption'; | ||
@@ -9,2 +8,3 @@ import { ResolveLocale } from '../ResolveLocale'; | ||
import { invariant } from '../utils'; | ||
import { CoerceOptionsToObject } from '../CoerceOptionsToObject'; | ||
/** | ||
@@ -17,3 +17,3 @@ * https://tc39.es/ecma402/#sec-initializenumberformat | ||
var requestedLocales = CanonicalizeLocaleList(locales); | ||
var options = opts === undefined ? Object.create(null) : ToObject(opts); | ||
var options = CoerceOptionsToObject(opts); | ||
var opt = Object.create(null); | ||
@@ -20,0 +20,0 @@ var matcher = GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit'); |
@@ -28,2 +28,3 @@ import { FormatNumericToString } from './FormatNumericToString'; | ||
} | ||
; | ||
_b = ComputeExponent(numberFormat, x, { | ||
@@ -30,0 +31,0 @@ getInternalSlots: getInternalSlots, |
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList'; | ||
import { ToObject } from '../262'; | ||
import { GetOption } from '../GetOption'; | ||
import { SetNumberFormatDigitOptions } from '../NumberFormat/SetNumberFormatDigitOptions'; | ||
import { ResolveLocale } from '../ResolveLocale'; | ||
import { CoerceOptionsToObject } from '../CoerceOptionsToObject'; | ||
export function InitializePluralRules(pl, locales, options, _a) { | ||
@@ -10,3 +10,3 @@ var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots; | ||
var opt = Object.create(null); | ||
var opts = options === undefined ? Object.create(null) : ToObject(options); | ||
var opts = CoerceOptionsToObject(options); | ||
var internalSlots = getInternalSlots(pl); | ||
@@ -13,0 +13,0 @@ internalSlots.initializedPluralRules = true; |
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList'; | ||
import { ToObject } from '../262'; | ||
import { GetOption } from '../GetOption'; | ||
import { ResolveLocale } from '../ResolveLocale'; | ||
import { invariant } from '../utils'; | ||
import { CoerceOptionsToObject } from '../CoerceOptionsToObject'; | ||
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i; | ||
@@ -13,6 +13,8 @@ export function InitializeRelativeTimeFormat(rtf, locales, options, _a) { | ||
var opt = Object.create(null); | ||
var opts = options === undefined ? Object.create(null) : ToObject(options); | ||
var opts = CoerceOptionsToObject(options); | ||
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
opt.localeMatcher = matcher; | ||
var numberingSystem = GetOption(opts, 'numberingSystem', 'string', undefined, undefined); | ||
var numberingSystem = GetOption(opts, | ||
// @ts-expect-error TS option is wack | ||
'numberingSystem', 'string', undefined, undefined); | ||
if (numberingSystem !== undefined) { | ||
@@ -19,0 +21,0 @@ if (!NUMBERING_SYSTEM_REGEX.test(numberingSystem)) { |
@@ -5,3 +5,2 @@ "use strict"; | ||
var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList"); | ||
var _262_1 = require("../262"); | ||
var GetOption_1 = require("../GetOption"); | ||
@@ -13,2 +12,3 @@ var ResolveLocale_1 = require("../ResolveLocale"); | ||
var utils_1 = require("../utils"); | ||
var CoerceOptionsToObject_1 = require("../CoerceOptionsToObject"); | ||
/** | ||
@@ -21,3 +21,3 @@ * https://tc39.es/ecma402/#sec-initializenumberformat | ||
var requestedLocales = CanonicalizeLocaleList_1.CanonicalizeLocaleList(locales); | ||
var options = opts === undefined ? Object.create(null) : _262_1.ToObject(opts); | ||
var options = CoerceOptionsToObject_1.CoerceOptionsToObject(opts); | ||
var opt = Object.create(null); | ||
@@ -24,0 +24,0 @@ var matcher = GetOption_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit'); |
@@ -32,2 +32,3 @@ "use strict"; | ||
} | ||
; | ||
_b = ComputeExponent_1.ComputeExponent(numberFormat, x, { | ||
@@ -34,0 +35,0 @@ getInternalSlots: getInternalSlots, |
{ | ||
"name": "@formatjs/ecma402-abstract", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "A collection of implementation for ECMAScript abstract operations", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,6 +5,6 @@ "use strict"; | ||
var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList"); | ||
var _262_1 = require("../262"); | ||
var GetOption_1 = require("../GetOption"); | ||
var SetNumberFormatDigitOptions_1 = require("../NumberFormat/SetNumberFormatDigitOptions"); | ||
var ResolveLocale_1 = require("../ResolveLocale"); | ||
var CoerceOptionsToObject_1 = require("../CoerceOptionsToObject"); | ||
function InitializePluralRules(pl, locales, options, _a) { | ||
@@ -14,3 +14,3 @@ var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots; | ||
var opt = Object.create(null); | ||
var opts = options === undefined ? Object.create(null) : _262_1.ToObject(options); | ||
var opts = CoerceOptionsToObject_1.CoerceOptionsToObject(options); | ||
var internalSlots = getInternalSlots(pl); | ||
@@ -17,0 +17,0 @@ internalSlots.initializedPluralRules = true; |
@@ -5,6 +5,6 @@ "use strict"; | ||
var CanonicalizeLocaleList_1 = require("../CanonicalizeLocaleList"); | ||
var _262_1 = require("../262"); | ||
var GetOption_1 = require("../GetOption"); | ||
var ResolveLocale_1 = require("../ResolveLocale"); | ||
var utils_1 = require("../utils"); | ||
var CoerceOptionsToObject_1 = require("../CoerceOptionsToObject"); | ||
var NUMBERING_SYSTEM_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i; | ||
@@ -17,6 +17,8 @@ function InitializeRelativeTimeFormat(rtf, locales, options, _a) { | ||
var opt = Object.create(null); | ||
var opts = options === undefined ? Object.create(null) : _262_1.ToObject(options); | ||
var opts = CoerceOptionsToObject_1.CoerceOptionsToObject(options); | ||
var matcher = GetOption_1.GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
opt.localeMatcher = matcher; | ||
var numberingSystem = GetOption_1.GetOption(opts, 'numberingSystem', 'string', undefined, undefined); | ||
var numberingSystem = GetOption_1.GetOption(opts, | ||
// @ts-expect-error TS option is wack | ||
'numberingSystem', 'string', undefined, undefined); | ||
if (numberingSystem !== undefined) { | ||
@@ -23,0 +25,0 @@ if (!NUMBERING_SYSTEM_REGEX.test(numberingSystem)) { |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
470824
407
9340