How to use the @phensley/cldr-core/lib/resource/checksum.checksumIndices function in @phensley/cldr-core

To help you get started, we’ve selected a few @phensley/cldr-core 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 / compiler / dump.ts View on Github external
export const runDump = (argv: yargs.Arguments) => {
  let raw: string;
  let config: any = CONFIG;

  if (argv.config) {
    raw = fs.readFileSync(argv.config).toString('utf-8');
    config = JSON.parse(raw);
  }

  raw = fs.readFileSync(argv.pack).toString('utf-8');
  const data = JSON.parse(raw);

  const schema = ({} as any) as Schema;
  const origin = new CodeBuilder(config).origin();
  const ck = checksumIndices(VERSION, origin.indices);
  console.log(`Checksum ${ck}`);

  const builder = new SchemaBuilder(false);
  builder.construct(schema, origin);

  const opts = { verbose: false };
  Object.keys(data.scripts).forEach(name => {
    const strings = data.scripts[name].strings.split('_');
    const entries = scan(schema, 1, opts);
    display(entries, strings);
  });
};