Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fastTag = (real: LanguageTag): FastTag => {
// Hack to get fast access to internal core fields without exposing them.
const fake = (real as any) as FakeLanguageTag;
// The fast tag is used for indexing purposes. Since a field may be
// undefined, and we don't want to use its string representation of
// the undefined value (e.g. 'und', 'Zzzz', etc), we use the field's
// index number to represent undefined.
const language = fake.core[Tag.LANGUAGE];
const script = fake.core[Tag.SCRIPT];
const region = fake.core[Tag.REGION];
return [
language || Tag.LANGUAGE,
script || Tag.SCRIPT,
region || Tag.REGION
];
};
const setFields = (src: FastTag, dst: FastTag, flags: number): void => {
dst[Tag.LANGUAGE] = (flags & F.LANGUAGE) === 0 ? Tag.LANGUAGE : src[Tag.LANGUAGE];
dst[Tag.SCRIPT] = (flags & F.SCRIPT) === 0 ? Tag.SCRIPT : src[Tag.SCRIPT];
dst[Tag.REGION] = (flags & F.REGION) === 0 ? Tag.REGION : src[Tag.REGION];
};