Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
protected readonly bundle: Bundle,
protected readonly internals: Internals,
private readonly schema: CalendarSchema,
readonly cacheSize: number = 50
) {
this.language = bundle.language();
this.region = bundle.region();
this.skeletonParser = this.buildSkeletonParser();
this.skeletonRequestCache = new LRU(cacheSize);
this.intervalRequestCache = new LRU(cacheSize);
this.namesCache = new LRU(cacheSize);
// Fetch this locale's main formats
this.dateFormats = schema.dateFormats.mapping(bundle);
this.timeFormats = schema.timeFormats.mapping(bundle);
this.wrapperFormats = schema.dateTimeFormats.mapping(bundle);
// Fetch skeletons and build best-fit matchers
this.rawAvailableFormats = this.schema.availableFormats.mapping(bundle);
this.rawPluralFormats = this.schema.pluralFormats.mapping(bundle);
this.rawIntervalFormats = this.schema.intervalFormats.mapping(bundle);
this.buildAvailableMatcher();
this.buildIntervalMatcher();
this.intervalFallback = this.schema.intervalFormatFallback.get(bundle);
}
constructor(
protected readonly bundle: Bundle,
protected readonly internals: Internals,
private readonly schema: CalendarSchema,
readonly cacheSize: number = 50
) {
this.language = bundle.language();
this.region = bundle.region();
this.skeletonParser = this.buildSkeletonParser();
this.skeletonRequestCache = new LRU(cacheSize);
this.intervalRequestCache = new LRU(cacheSize);
this.namesCache = new LRU(cacheSize);
// Fetch this locale's main formats
this.dateFormats = schema.dateFormats.mapping(bundle);
this.timeFormats = schema.timeFormats.mapping(bundle);
this.wrapperFormats = schema.dateTimeFormats.mapping(bundle);
// Fetch skeletons and build best-fit matchers
this.rawAvailableFormats = this.schema.availableFormats.mapping(bundle);
this.rawPluralFormats = this.schema.pluralFormats.mapping(bundle);
this.rawIntervalFormats = this.schema.intervalFormats.mapping(bundle);
this.buildAvailableMatcher();
this.buildIntervalMatcher();
this.intervalFallback = this.schema.intervalFormatFallback.get(bundle);
}
constructor(
protected readonly bundle: Bundle,
protected readonly internals: Internals,
private readonly schema: CalendarSchema,
readonly cacheSize: number = 50
) {
this.language = bundle.language();
this.region = bundle.region();
this.skeletonParser = this.buildSkeletonParser();
this.skeletonRequestCache = new LRU(cacheSize);
this.intervalRequestCache = new LRU(cacheSize);
this.namesCache = new LRU(cacheSize);
// Fetch this locale's main formats
this.dateFormats = schema.dateFormats.mapping(bundle);
this.timeFormats = schema.timeFormats.mapping(bundle);
this.wrapperFormats = schema.dateTimeFormats.mapping(bundle);
// Fetch skeletons and build best-fit matchers
this.rawAvailableFormats = this.schema.availableFormats.mapping(bundle);
this.rawPluralFormats = this.schema.pluralFormats.mapping(bundle);
this.rawIntervalFormats = this.schema.intervalFormats.mapping(bundle);
this.buildAvailableMatcher();
this.buildIntervalMatcher();
this.intervalFallback = this.schema.intervalFormatFallback.get(bundle);
import * as fs from 'fs';
import { join } from 'path';
import { SchemaConfig } from '@phensley/cldr-schema';
import { LRU } from '@phensley/cldr-utils';
import { LanguageResolver } from '@phensley/locale';
import { Bundle, Pack } from '../../src/resource';
import { CLDRFramework } from '../../src';
import { VERSION } from '../../src/utils/version';
const pkg = require('../../package.json');
const TEMPROOT = join(__dirname, '..', '..', '.custom-packs');
const bundleCache = new LRU(15);
interface PackSpec {
hash: string;
config: string;
}
const makedir = (dir: string) => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
};
/**
* Configure a framework with a loader that will load a custom resource pack.
* This allows us to test purposefully-mismatched resource pack and framework
* checksums;
constructor(protected options: CLDROptions) {
this.packCache = new LRU(options.packCacheSize || 2);
this.loader = options.loader;
this.asyncLoader = options.asyncLoader;
const patternCacheSize = options.patternCacheSize || 200;
this.internals = new InternalsImpl(
options.config || CLDRFramework.defaultConfig || EMPTY_CONFIG,
VERSION, options.debug, patternCacheSize);
}