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