build-unicode.mjs 460 B

12345678910111213141516171819
  1. import fs from 'fs';
  2. import path from 'path';
  3. import C from '@unicode/unicode-15.0.0/Case_Folding/C/symbols.js';
  4. import S from '@unicode/unicode-15.0.0/Case_Folding/S/symbols.js';
  5. function normalize(map) {
  6. return Object.fromEntries(Array.from(map, ([o, i]) => [i, [].concat(o)[0]]));
  7. }
  8. const cases = {
  9. C: normalize(C),
  10. S: normalize(S),
  11. };
  12. fs.writeFileSync(
  13. path.join(process.cwd(), './helpers/caseFolding.json'),
  14. JSON.stringify(cases, null, '\t'),
  15. );