How to use the @phensley/cldr-utils.bitarrayCreate function in @phensley/cldr-utils

To help you get started, we’ve selected a few @phensley/cldr-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phensley / cldr-engine / packages / cldr-compiler / src / cli / generator / preprocess / zonedst.ts View on Github external
export const getZoneDST = (): any => {
  const path = join(__dirname, '..', '..', '..', '..', 'data', 'timezones', 'temp', 'tzdata.json');
  const raw = fs.readFileSync(path);
  const data = JSON.parse(raw.toString());

  const inverted: any = {};
  for (const row of data) {
    const [ name, _indexed, _untils, _dsts ] = row;
    const [ _offsets, _index ] = _indexed;

    const offsets = _offsets.join(' ');
    const index = _index.map(base100encode).join(' ');
    const untils = _untils.map(base100encode).join(' ');
    const dsts = bitarrayCreate(_dsts).map(base100encode).join(' ');

    const key = [offsets, index, untils, dsts].join('\t');
    const ids = inverted[key] || [];
    ids.push(name);
    inverted[key] = ids;
  }

  const zoneDST: any = {};
  const zoneLinks: any = {};
  Object.keys(inverted).forEach(info => {
    const keys = inverted[info];
    const first = keys[0];
    zoneDST[first] = info;
    keys.slice(1).forEach((k: string) => {
      zoneLinks[k] = first;
    });

@phensley/cldr-utils

Utilities for cldr-engine packages

Apache-2.0
Latest version published 15 days ago

Package Health Score

62 / 100
Full package analysis

Similar packages