memory-code-points.js 818 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const fs = require('fs');
  3. const path = require('path');
  4. const bitfield = require('sparse-bitfield');
  5. const memory = fs.readFileSync(path.resolve(__dirname, '../code-points.mem'));
  6. let offset = 0;
  7. function read() {
  8. const size = memory.readUInt32BE(offset);
  9. offset += 4;
  10. const codepoints = memory.slice(offset, offset + size);
  11. offset += size;
  12. return bitfield({ buffer: codepoints });
  13. }
  14. const unassigned_code_points = read();
  15. const commonly_mapped_to_nothing = read();
  16. const non_ASCII_space_characters = read();
  17. const prohibited_characters = read();
  18. const bidirectional_r_al = read();
  19. const bidirectional_l = read();
  20. module.exports = {
  21. unassigned_code_points,
  22. commonly_mapped_to_nothing,
  23. non_ASCII_space_characters,
  24. prohibited_characters,
  25. bidirectional_r_al,
  26. bidirectional_l,
  27. }