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.5.4 to 1.6.0

14

262.d.ts

@@ -74,3 +74,3 @@ /**

*/
export declare function MonthFromTime(t: number): 1 | 0 | 4 | 7 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11;
export declare function MonthFromTime(t: number): 0 | 1 | 2 | 3 | 4 | 7 | 5 | 6 | 8 | 9 | 10 | 11;
export declare function DateFromTime(t: number): number;

@@ -80,2 +80,14 @@ export declare function HourFromTime(t: number): number;

export declare function SecFromTime(t: number): number;
/**
* The abstract operation OrdinaryHasInstance implements
* the default algorithm for determining if an object O
* inherits from the instance object inheritance path
* provided by constructor C.
* @param C class
* @param O object
* @param internalSlots internalSlots
*/
export declare function OrdinaryHasInstance(C: Object, O: any, internalSlots?: {
boundTargetFunction: any;
}): boolean;
//# sourceMappingURL=262.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecFromTime = exports.MinFromTime = exports.HourFromTime = exports.DateFromTime = exports.MonthFromTime = exports.InLeapYear = exports.DayWithinYear = exports.DaysInYear = exports.YearFromTime = exports.TimeFromYear = exports.DayFromYear = exports.WeekDay = exports.Day = exports.Type = exports.HasOwnProperty = exports.ArrayCreate = exports.SameValue = exports.ToObject = exports.TimeClip = exports.ToNumber = exports.ToString = void 0;
exports.OrdinaryHasInstance = exports.SecFromTime = exports.MinFromTime = exports.HourFromTime = exports.DateFromTime = exports.MonthFromTime = exports.InLeapYear = exports.DayWithinYear = exports.DaysInYear = exports.YearFromTime = exports.TimeFromYear = exports.DayFromYear = exports.WeekDay = exports.Day = exports.Type = exports.HasOwnProperty = exports.ArrayCreate = exports.SameValue = exports.ToObject = exports.TimeClip = exports.ToNumber = exports.ToString = void 0;
/**

@@ -337,1 +337,31 @@ * https://tc39.es/ecma262/#sec-tostring

exports.SecFromTime = SecFromTime;
function IsCallable(fn) {
return typeof fn === 'function';
}
/**
* The abstract operation OrdinaryHasInstance implements
* the default algorithm for determining if an object O
* inherits from the instance object inheritance path
* provided by constructor C.
* @param C class
* @param O object
* @param internalSlots internalSlots
*/
function OrdinaryHasInstance(C, O, internalSlots) {
if (!IsCallable(C)) {
return false;
}
if (internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction) {
var BC = internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction;
return O instanceof BC;
}
if (typeof O !== 'object') {
return false;
}
var P = C.prototype;
if (typeof P !== 'object') {
throw new TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
}
return Object.prototype.isPrototypeOf.call(P, O);
}
exports.OrdinaryHasInstance = OrdinaryHasInstance;

4

DateTimeFormat/InitializeDateTimeFormat.js

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

}
matcher = GetOption_1.GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var formatMatcher = GetOption_1.GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var dateStyle = GetOption_1.GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);

@@ -128,3 +128,3 @@ internalSlots.dateStyle = dateStyle;

if (dateStyle === undefined && timeStyle === undefined) {
if (matcher === 'basic') {
if (formatMatcher === 'basic') {
bestFormat = BasicFormatMatcher_1.BasicFormatMatcher(opt, formats);

@@ -131,0 +131,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PartitionDateTimeRangePattern = void 0;
var date_time_1 = require("../types/date-time");
var _262_1 = require("../262");

@@ -78,3 +79,3 @@ var ToLocalTime_1 = require("./ToLocalTime");

var r = result_1[_a];
r.source = "shared" /* shared */;
r.source = date_time_1.RangePatternType.shared;
}

@@ -99,4 +100,4 @@ return result_2;

var z = void 0;
if (source === "startRange" /* startRange */ ||
source === "shared" /* shared */) {
if (source === date_time_1.RangePatternType.startRange ||
source === date_time_1.RangePatternType.shared) {
z = x;

@@ -103,0 +104,0 @@ }

@@ -5,2 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var date_time_1 = require("../types/date-time");
/**

@@ -56,4 +57,4 @@ * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table

result.weekday = [
'numeric',
'2-digit',
undefined,
undefined,
'short',

@@ -67,4 +68,4 @@ 'long',

result.weekday = [
'numeric',
undefined,
undefined,
'short',

@@ -252,3 +253,3 @@ 'long',

return {
source: "startRange" /* startRange */,
source: date_time_1.RangePatternType.startRange,
pattern: pattern,

@@ -258,3 +259,3 @@ };

return {
source: "endRange" /* endRange */,
source: date_time_1.RangePatternType.endRange,
pattern: pattern,

@@ -264,3 +265,3 @@ };

return {
source: "shared" /* shared */,
source: date_time_1.RangePatternType.shared,
pattern: pattern,

@@ -290,3 +291,3 @@ };

{
source: "startRange" /* startRange */,
source: date_time_1.RangePatternType.startRange,
pattern: pattern,

@@ -298,7 +299,7 @@ },

{
source: "startRange" /* startRange */,
source: date_time_1.RangePatternType.startRange,
pattern: pattern.slice(0, splitIndex),
},
{
source: "endRange" /* endRange */,
source: date_time_1.RangePatternType.endRange,
pattern: pattern.slice(splitIndex),

@@ -305,0 +306,0 @@ },

@@ -46,3 +46,4 @@ export { BestFitFormatMatcher } from './DateTimeFormat/BestFitFormatMatcher';

export { parseDateTimeSkeleton } from './DateTimeFormat/skeleton';
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, LiteralPart, setInternalSlot, setMultiInternalSlots, getMagnitude, defineProperty, } from './utils';
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, getMagnitude, defineProperty, } from './utils';
export type { LiteralPart } from './utils';
export { isMissingLocaleDataError } from './data';

@@ -56,4 +57,4 @@ export * from './types/relative-time';

export { invariant } from './utils';
export { LocaleData } from './types/core';
export type { LocaleData } from './types/core';
export * from './262';
//# sourceMappingURL=index.d.ts.map

@@ -74,3 +74,3 @@ /**

*/
export declare function MonthFromTime(t: number): 1 | 0 | 4 | 7 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11;
export declare function MonthFromTime(t: number): 0 | 1 | 2 | 3 | 4 | 7 | 5 | 6 | 8 | 9 | 10 | 11;
export declare function DateFromTime(t: number): number;

@@ -80,2 +80,14 @@ export declare function HourFromTime(t: number): number;

export declare function SecFromTime(t: number): number;
/**
* The abstract operation OrdinaryHasInstance implements
* the default algorithm for determining if an object O
* inherits from the instance object inheritance path
* provided by constructor C.
* @param C class
* @param O object
* @param internalSlots internalSlots
*/
export declare function OrdinaryHasInstance(C: Object, O: any, internalSlots?: {
boundTargetFunction: any;
}): boolean;
//# sourceMappingURL=262.d.ts.map

@@ -313,1 +313,30 @@ /**

}
function IsCallable(fn) {
return typeof fn === 'function';
}
/**
* The abstract operation OrdinaryHasInstance implements
* the default algorithm for determining if an object O
* inherits from the instance object inheritance path
* provided by constructor C.
* @param C class
* @param O object
* @param internalSlots internalSlots
*/
export function OrdinaryHasInstance(C, O, internalSlots) {
if (!IsCallable(C)) {
return false;
}
if (internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction) {
var BC = internalSlots === null || internalSlots === void 0 ? void 0 : internalSlots.boundTargetFunction;
return O instanceof BC;
}
if (typeof O !== 'object') {
return false;
}
var P = C.prototype;
if (typeof P !== 'object') {
throw new TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.');
}
return Object.prototype.isPrototypeOf.call(P, O);
}

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

}
matcher = GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var formatMatcher = GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
var dateStyle = GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);

@@ -125,3 +125,3 @@ internalSlots.dateStyle = dateStyle;

if (dateStyle === undefined && timeStyle === undefined) {
if (matcher === 'basic') {
if (formatMatcher === 'basic') {
bestFormat = BasicFormatMatcher(opt, formats);

@@ -128,0 +128,0 @@ }

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

import { RangePatternType, } from '../types/date-time';
import { SameValue, TimeClip } from '../262';

@@ -75,3 +76,3 @@ import { ToLocalTime } from './ToLocalTime';

var r = result_1[_a];
r.source = "shared" /* shared */;
r.source = RangePatternType.shared;
}

@@ -96,4 +97,4 @@ return result_2;

var z = void 0;
if (source === "startRange" /* startRange */ ||
source === "shared" /* shared */) {
if (source === RangePatternType.startRange ||
source === RangePatternType.shared) {
z = x;

@@ -100,0 +101,0 @@ }

import { __assign } from "tslib";
import { RangePatternType, } from '../types/date-time';
/**

@@ -52,4 +53,4 @@ * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table

result.weekday = [
'numeric',
'2-digit',
undefined,
undefined,
'short',

@@ -63,4 +64,4 @@ 'long',

result.weekday = [
'numeric',
undefined,
undefined,
'short',

@@ -246,3 +247,3 @@ 'long',

return {
source: "startRange" /* startRange */,
source: RangePatternType.startRange,
pattern: pattern,

@@ -252,3 +253,3 @@ };

return {
source: "endRange" /* endRange */,
source: RangePatternType.endRange,
pattern: pattern,

@@ -258,3 +259,3 @@ };

return {
source: "shared" /* shared */,
source: RangePatternType.shared,
pattern: pattern,

@@ -283,3 +284,3 @@ };

{
source: "startRange" /* startRange */,
source: RangePatternType.startRange,
pattern: pattern,

@@ -291,7 +292,7 @@ },

{
source: "startRange" /* startRange */,
source: RangePatternType.startRange,
pattern: pattern.slice(0, splitIndex),
},
{
source: "endRange" /* endRange */,
source: RangePatternType.endRange,
pattern: pattern.slice(splitIndex),

@@ -298,0 +299,0 @@ },

@@ -46,3 +46,4 @@ export { BestFitFormatMatcher } from './DateTimeFormat/BestFitFormatMatcher';

export { parseDateTimeSkeleton } from './DateTimeFormat/skeleton';
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, LiteralPart, setInternalSlot, setMultiInternalSlots, getMagnitude, defineProperty, } from './utils';
export { getInternalSlot, getMultiInternalSlots, isLiteralPart, setInternalSlot, setMultiInternalSlots, getMagnitude, defineProperty, } from './utils';
export type { LiteralPart } from './utils';
export { isMissingLocaleDataError } from './data';

@@ -56,4 +57,4 @@ export * from './types/relative-time';

export { invariant } from './utils';
export { LocaleData } from './types/core';
export type { LocaleData } from './types/core';
export * from './262';
//# sourceMappingURL=index.d.ts.map

@@ -1,5 +0,5 @@

import { RelativeTimeFormat, RelativeTimeFormattableUnit, RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTime(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, implDetails: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTime(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, implDetails: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): string;
//# sourceMappingURL=FormatRelativeTime.d.ts.map

@@ -1,5 +0,5 @@

import { RelativeTimeFormat, RelativeTimeFormattableUnit, RelativeTimePart, RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTimeToParts(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, implDetails: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
}): RelativeTimePart[];
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTimeToParts(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, implDetails: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=FormatRelativeTimeToParts.d.ts.map

@@ -1,4 +0,4 @@

import { RelativeTimeFormat, IntlRelativeTimeFormatOptions, RelativeTimeFormatInternal, LocaleFieldsData } from '../types/relative-time';
export declare function InitializeRelativeTimeFormat(rtf: RelativeTimeFormat, locales: string | string[] | undefined, options: IntlRelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
import { RelativeTimeFormatInternal, LocaleFieldsData } from '../types/relative-time';
export declare function InitializeRelativeTimeFormat(rtf: Intl.RelativeTimeFormat, locales: string | string[] | undefined, options: Intl.RelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
availableLocales: Set<string>;

@@ -8,3 +8,3 @@ relevantExtensionKeys: string[];

getDefaultLocale(): string;
}): RelativeTimeFormat;
}): Intl.RelativeTimeFormat;
//# sourceMappingURL=InitializeRelativeTimeFormat.d.ts.map

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

import { RelativeTimeUnit, RelativeTimePart } from '../types/relative-time';
export declare function MakePartsList(pattern: string, unit: RelativeTimeUnit, parts: Intl.NumberFormatPart[]): RelativeTimePart[];
export declare function MakePartsList(pattern: string, unit: Intl.RelativeTimeFormatUnit, parts: Intl.NumberFormatPart[] | Intl.RelativeTimeFormatPart[]): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=MakePartsList.d.ts.map

@@ -1,5 +0,5 @@

import { RelativeTimeFormattableUnit, RelativeTimeFormat, RelativeTimeFormatInternal, RelativeTimePart } from '../types/relative-time';
export declare function PartitionRelativeTimePattern(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, { getInternalSlots, }: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
}): RelativeTimePart[];
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function PartitionRelativeTimePattern(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, { getInternalSlots, }: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=PartitionRelativeTimePattern.d.ts.map

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

import { RelativeTimeFormattableUnit, RelativeTimeUnit } from '../types/relative-time';
import { RelativeTimeFormatSingularUnit } from '../types/relative-time';
/**

@@ -6,3 +6,3 @@ * https://tc39.es/proposal-intl-relative-time/#sec-singularrelativetimeunit

*/
export declare function SingularRelativeTimeUnit(unit: RelativeTimeFormattableUnit): RelativeTimeUnit;
export declare function SingularRelativeTimeUnit(unit: Intl.RelativeTimeFormatUnit): RelativeTimeFormatSingularUnit;
//# sourceMappingURL=SingularRelativeTimeUnit.d.ts.map

@@ -5,4 +5,3 @@ export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {

timeStyle?: 'full' | 'long' | 'medium' | 'short';
fractionalSecondDigits?: number;
calendar?: 'gregory';
calendar?: string;
numberingSystem?: string;

@@ -50,3 +49,3 @@ }

};
export declare const enum RangePatternType {
export declare enum RangePatternType {
startRange = "startRange",

@@ -53,0 +52,0 @@ shared = "shared",

import { LocaleData } from './core';
import { LDMLPluralRule } from './plural-rules';
import { LiteralPart } from '../utils';
export interface FieldData {

@@ -29,55 +28,4 @@ '0'?: string;

export declare type RelativeTimeField = 'second' | 'second-short' | 'second-narrow' | 'minute' | 'minute-short' | 'minute-narrow' | 'hour' | 'hour-short' | 'hour-narrow' | 'day' | 'day-short' | 'day-narrow' | 'week' | 'week-short' | 'week-narrow' | 'month' | 'month-short' | 'month-narrow' | 'quarter' | 'quarter-short' | 'quarter-narrow' | 'year' | 'year-short' | 'year-narrow';
export declare type RelativeTimeFormatSingularUnit = Exclude<Intl.RelativeTimeFormatUnit, 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'>;
export declare type RelativeTimeLocaleData = LocaleData<LocaleFieldsData>;
export declare type RelativeTimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
export declare type RelativeTimeUnits = 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years';
export declare type RelativeTimeFormattableUnit = RelativeTimeUnit | RelativeTimeUnits;
export declare type RelativeTimePart = LiteralPart | RelativeTimeFormatNumberPart;
export interface RelativeTimeFormatNumberPart extends Intl.NumberFormatPart {
unit: RelativeTimeUnit;
}
export interface IntlRelativeTimeFormatOptions {
/**
* The locale matching algorithm to use.
* Possible values are "lookup" and "best fit"; the default is "best fit".
* For information about this option, see
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation.
*/
localeMatcher?: 'best fit' | 'lookup';
/**
* The format of output message. Possible values are:
* - "always" (default, e.g., 1 day ago),
* - or "auto" (e.g., yesterday).
* The "auto" value allows to not always have to
* use numeric values in the output.
*/
numeric?: 'always' | 'auto';
/**
* The length of the internationalized message. Possible values are:
* - "long" (default, e.g., in 1 month)
* - "short" (e.g., in 1 mo.),
* - or "narrow" (e.g., in 1 mo.).
* The narrow style could be similar to the short style for some locales.
*/
style?: 'long' | 'short' | 'narrow';
}
export interface ResolvedIntlRelativeTimeFormatOptions extends Pick<IntlRelativeTimeFormatOptions, 'style' | 'numeric'> {
/**
* The BCP 47 language tag for the locale actually used.
* If any Unicode extension values were requested in the
* input BCP 47 language tag that led to this locale,
* the key-value pairs that were requested and are
* supported for this locale are included in locale.
*/
locale: string;
/**
* The value requested using the Unicode
* extension key "nu" or filled in as a default.
*/
numberingSystem: string;
}
export interface RelativeTimeFormat {
format(value: number, unit: RelativeTimeFormattableUnit): string;
formatToParts(value: number, unit: RelativeTimeFormattableUnit): RelativeTimePart[];
resolvedOptions(): ResolvedIntlRelativeTimeFormatOptions;
}
export interface RelativeTimeFormatInternal {

@@ -88,4 +36,4 @@ numberFormat: Intl.NumberFormat;

fields: LocaleFieldsData;
style: IntlRelativeTimeFormatOptions['style'];
numeric: IntlRelativeTimeFormatOptions['numeric'];
style: Intl.ResolvedRelativeTimeFormatOptions['style'];
numeric: Intl.ResolvedRelativeTimeFormatOptions['numeric'];
numberingSystem: string;

@@ -92,0 +40,0 @@ initializedRelativeTimeFormat: boolean;

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

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

@@ -1,5 +0,5 @@

import { RelativeTimeFormat, RelativeTimeFormattableUnit, RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTime(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, implDetails: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTime(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, implDetails: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): string;
//# sourceMappingURL=FormatRelativeTime.d.ts.map

@@ -1,5 +0,5 @@

import { RelativeTimeFormat, RelativeTimeFormattableUnit, RelativeTimePart, RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTimeToParts(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, implDetails: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
}): RelativeTimePart[];
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function FormatRelativeTimeToParts(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, implDetails: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=FormatRelativeTimeToParts.d.ts.map

@@ -1,4 +0,4 @@

import { RelativeTimeFormat, IntlRelativeTimeFormatOptions, RelativeTimeFormatInternal, LocaleFieldsData } from '../types/relative-time';
export declare function InitializeRelativeTimeFormat(rtf: RelativeTimeFormat, locales: string | string[] | undefined, options: IntlRelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
import { RelativeTimeFormatInternal, LocaleFieldsData } from '../types/relative-time';
export declare function InitializeRelativeTimeFormat(rtf: Intl.RelativeTimeFormat, locales: string | string[] | undefined, options: Intl.RelativeTimeFormatOptions | undefined, { getInternalSlots, availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, }: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
availableLocales: Set<string>;

@@ -8,3 +8,3 @@ relevantExtensionKeys: string[];

getDefaultLocale(): string;
}): RelativeTimeFormat;
}): Intl.RelativeTimeFormat;
//# sourceMappingURL=InitializeRelativeTimeFormat.d.ts.map

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

import { RelativeTimeUnit, RelativeTimePart } from '../types/relative-time';
export declare function MakePartsList(pattern: string, unit: RelativeTimeUnit, parts: Intl.NumberFormatPart[]): RelativeTimePart[];
export declare function MakePartsList(pattern: string, unit: Intl.RelativeTimeFormatUnit, parts: Intl.NumberFormatPart[] | Intl.RelativeTimeFormatPart[]): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=MakePartsList.d.ts.map

@@ -1,5 +0,5 @@

import { RelativeTimeFormattableUnit, RelativeTimeFormat, RelativeTimeFormatInternal, RelativeTimePart } from '../types/relative-time';
export declare function PartitionRelativeTimePattern(rtf: RelativeTimeFormat, value: number, unit: RelativeTimeFormattableUnit, { getInternalSlots, }: {
getInternalSlots(rtf: RelativeTimeFormat): RelativeTimeFormatInternal;
}): RelativeTimePart[];
import { RelativeTimeFormatInternal } from '../types/relative-time';
export declare function PartitionRelativeTimePattern(rtf: Intl.RelativeTimeFormat, value: number, unit: Intl.RelativeTimeFormatUnit, { getInternalSlots, }: {
getInternalSlots(rtf: Intl.RelativeTimeFormat): RelativeTimeFormatInternal;
}): Intl.RelativeTimeFormatPart[];
//# sourceMappingURL=PartitionRelativeTimePattern.d.ts.map

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

import { RelativeTimeFormattableUnit, RelativeTimeUnit } from '../types/relative-time';
import { RelativeTimeFormatSingularUnit } from '../types/relative-time';
/**

@@ -6,3 +6,3 @@ * https://tc39.es/proposal-intl-relative-time/#sec-singularrelativetimeunit

*/
export declare function SingularRelativeTimeUnit(unit: RelativeTimeFormattableUnit): RelativeTimeUnit;
export declare function SingularRelativeTimeUnit(unit: Intl.RelativeTimeFormatUnit): RelativeTimeFormatSingularUnit;
//# sourceMappingURL=SingularRelativeTimeUnit.d.ts.map

@@ -5,4 +5,3 @@ export interface DateTimeFormatOptions extends Intl.DateTimeFormatOptions {

timeStyle?: 'full' | 'long' | 'medium' | 'short';
fractionalSecondDigits?: number;
calendar?: 'gregory';
calendar?: string;
numberingSystem?: string;

@@ -50,3 +49,3 @@ }

};
export declare const enum RangePatternType {
export declare enum RangePatternType {
startRange = "startRange",

@@ -53,0 +52,0 @@ shared = "shared",

import { LocaleData } from './core';
import { LDMLPluralRule } from './plural-rules';
import { LiteralPart } from '../utils';
export interface FieldData {

@@ -29,55 +28,4 @@ '0'?: string;

export declare type RelativeTimeField = 'second' | 'second-short' | 'second-narrow' | 'minute' | 'minute-short' | 'minute-narrow' | 'hour' | 'hour-short' | 'hour-narrow' | 'day' | 'day-short' | 'day-narrow' | 'week' | 'week-short' | 'week-narrow' | 'month' | 'month-short' | 'month-narrow' | 'quarter' | 'quarter-short' | 'quarter-narrow' | 'year' | 'year-short' | 'year-narrow';
export declare type RelativeTimeFormatSingularUnit = Exclude<Intl.RelativeTimeFormatUnit, 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years'>;
export declare type RelativeTimeLocaleData = LocaleData<LocaleFieldsData>;
export declare type RelativeTimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
export declare type RelativeTimeUnits = 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years';
export declare type RelativeTimeFormattableUnit = RelativeTimeUnit | RelativeTimeUnits;
export declare type RelativeTimePart = LiteralPart | RelativeTimeFormatNumberPart;
export interface RelativeTimeFormatNumberPart extends Intl.NumberFormatPart {
unit: RelativeTimeUnit;
}
export interface IntlRelativeTimeFormatOptions {
/**
* The locale matching algorithm to use.
* Possible values are "lookup" and "best fit"; the default is "best fit".
* For information about this option, see
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation.
*/
localeMatcher?: 'best fit' | 'lookup';
/**
* The format of output message. Possible values are:
* - "always" (default, e.g., 1 day ago),
* - or "auto" (e.g., yesterday).
* The "auto" value allows to not always have to
* use numeric values in the output.
*/
numeric?: 'always' | 'auto';
/**
* The length of the internationalized message. Possible values are:
* - "long" (default, e.g., in 1 month)
* - "short" (e.g., in 1 mo.),
* - or "narrow" (e.g., in 1 mo.).
* The narrow style could be similar to the short style for some locales.
*/
style?: 'long' | 'short' | 'narrow';
}
export interface ResolvedIntlRelativeTimeFormatOptions extends Pick<IntlRelativeTimeFormatOptions, 'style' | 'numeric'> {
/**
* The BCP 47 language tag for the locale actually used.
* If any Unicode extension values were requested in the
* input BCP 47 language tag that led to this locale,
* the key-value pairs that were requested and are
* supported for this locale are included in locale.
*/
locale: string;
/**
* The value requested using the Unicode
* extension key "nu" or filled in as a default.
*/
numberingSystem: string;
}
export interface RelativeTimeFormat {
format(value: number, unit: RelativeTimeFormattableUnit): string;
formatToParts(value: number, unit: RelativeTimeFormattableUnit): RelativeTimePart[];
resolvedOptions(): ResolvedIntlRelativeTimeFormatOptions;
}
export interface RelativeTimeFormatInternal {

@@ -88,4 +36,4 @@ numberFormat: Intl.NumberFormat;

fields: LocaleFieldsData;
style: IntlRelativeTimeFormatOptions['style'];
numeric: IntlRelativeTimeFormatOptions['numeric'];
style: Intl.ResolvedRelativeTimeFormatOptions['style'];
numeric: Intl.ResolvedRelativeTimeFormatOptions['numeric'];
numberingSystem: string;

@@ -92,0 +40,0 @@ initializedRelativeTimeFormat: boolean;

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

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