Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
readonly internals: Internals,
readonly cacheSize: number = 50
) {
this.schema = internals.schema;
this.dayPeriodRules = new DayPeriodRules(cacheSize);
this.patternCache = new Cache(parseDatePattern, cacheSize);
this.availableCalendars = new Set(internals.config.calendars || []);
this.hourPatternCache = new Cache((raw: string): [DateTimeNode[], DateTimeNode[]] => {
const parts = raw.split(';');
return [this.patternCache.get(parts[0]), this.patternCache.get(parts[1])];
}, cacheSize);
this.calendarFormatterCache = new Cache((calendar: string) => {
let s: CalendarSchema | undefined;
if (this.availableCalendars.has(calendar)) {
switch (calendar) {
case 'buddhist':
s = this.schema.Buddhist;
break;
case 'japanese':
s = this.schema.Japanese;
break;
constructor(
readonly internals: Internals,
readonly cacheSize: number = 50
) {
this.schema = internals.schema;
this.dayPeriodRules = new DayPeriodRules(cacheSize);
this.patternCache = new Cache(parseDatePattern, cacheSize);
this.availableCalendars = new Set(internals.config.calendars || []);
this.hourPatternCache = new Cache((raw: string): [DateTimeNode[], DateTimeNode[]] => {
const parts = raw.split(';');
return [this.patternCache.get(parts[0]), this.patternCache.get(parts[1])];
}, cacheSize);
this.calendarFormatterCache = new Cache((calendar: string) => {
let s: CalendarSchema | undefined;
if (this.availableCalendars.has(calendar)) {
switch (calendar) {
case 'buddhist':
s = this.schema.Buddhist;
break;
case 'japanese':
s = this.schema.Japanese;
break;
case 'persian':
s = this.schema.Persian;
break;
}
}
if (s === undefined) {
s = this.schema.Gregorian;
constructor(
readonly internals: Internals,
readonly cacheSize: number = 50
) {
this.schema = internals.schema;
this.dayPeriodRules = new DayPeriodRules(cacheSize);
this.patternCache = new Cache(parseDatePattern, cacheSize);
this.availableCalendars = new Set(internals.config.calendars || []);
this.hourPatternCache = new Cache((raw: string): [DateTimeNode[], DateTimeNode[]] => {
const parts = raw.split(';');
return [this.patternCache.get(parts[0]), this.patternCache.get(parts[1])];
}, cacheSize);
this.calendarFormatterCache = new Cache((calendar: string) => {
let s: CalendarSchema | undefined;
if (this.availableCalendars.has(calendar)) {
switch (calendar) {
case 'buddhist':
s = this.schema.Buddhist;
break;
case 'japanese':
s = this.schema.Japanese;
break;
case 'persian':
s = this.schema.Persian;
constructor(protected cacheSize: number) {
this.cache = new Cache(parseRule, cacheSize);
}
constructor(cacheSize: number = 50) {
this.wrapperPatternCache = new Cache(parseWrapperPattern, cacheSize);
}
constructor(
private readonly bundle: Bundle,
private readonly internals: Internals
) {
this.availableCalendars = new Set(internals.config.calendars || []);
const schema = internals.schema;
this.patternCache = new Cache((calendar: string) => {
if (this.availableCalendars.has(calendar)) {
switch (calendar) {
case 'buddhist':
return new CalendarPatterns(bundle, internals, schema.Buddhist);
case 'japanese':
return new CalendarPatterns(bundle, internals, schema.Japanese);
case 'persian':
return new CalendarPatterns(bundle, internals, schema.Persian);
}
}
return new GregorianPatterns(bundle, internals, schema.Gregorian);
}, 20);
}
constructor(readonly internals: Internals, cacheSize: number = 50) {
const schema = internals.schema;
this.currencies = schema.Currencies;
this.numbers = schema.Numbers;
this.numberPatternCache = new Cache(parseNumberPattern, cacheSize);
}
constructor(
protected bundle: Bundle,
protected internals: Internals
) {
this.numberParamsCache = new Cache((s: string) => this.build(s as NumberSystemName), 20);
this.numbers = internals.schema.Numbers;
this.latnSystemInfo = this.numbers.numberSystem.get('latn') as NumberSystemInfo;
this.latnSystem = this.buildNumberSystem('latn');
}
constructor(options: MessageFormatterOptions = { }) {
this.formatters = options.formatters || {};
this.plurals = options.plurals || pluralRules.get(options.language || 'root', options.region);
const size = options.cacheSize || DEFAULT_CACHE_SIZE;
this.matcher = buildMessageMatcher(Object.keys(this.formatters));
this.cache = new Cache(s => parseMessagePattern(s, this.matcher), size);
}
constructor(readonly internals: Internals, cacheSize: number = 50) {
const schema = internals.schema;
this.layout = schema.Layout;
this.names = schema.Names;
this.listPatterns = schema.ListPatterns;
this.wrapperPatternCache = new Cache(parseWrapperPattern, cacheSize);
}