constants.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _SET_BY_CODE;
  6. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  7. // constants for internal usage
  8. var SET_A = exports.SET_A = 0;
  9. var SET_B = exports.SET_B = 1;
  10. var SET_C = exports.SET_C = 2;
  11. // Special characters
  12. var SHIFT = exports.SHIFT = 98;
  13. var START_A = exports.START_A = 103;
  14. var START_B = exports.START_B = 104;
  15. var START_C = exports.START_C = 105;
  16. var MODULO = exports.MODULO = 103;
  17. var STOP = exports.STOP = 106;
  18. var FNC1 = exports.FNC1 = 207;
  19. // Get set by start code
  20. var SET_BY_CODE = exports.SET_BY_CODE = (_SET_BY_CODE = {}, _defineProperty(_SET_BY_CODE, START_A, SET_A), _defineProperty(_SET_BY_CODE, START_B, SET_B), _defineProperty(_SET_BY_CODE, START_C, SET_C), _SET_BY_CODE);
  21. // Get next set by code
  22. var SWAP = exports.SWAP = {
  23. 101: SET_A,
  24. 100: SET_B,
  25. 99: SET_C
  26. };
  27. var A_START_CHAR = exports.A_START_CHAR = String.fromCharCode(208); // START_A + 105
  28. var B_START_CHAR = exports.B_START_CHAR = String.fromCharCode(209); // START_B + 105
  29. var C_START_CHAR = exports.C_START_CHAR = String.fromCharCode(210); // START_C + 105
  30. // 128A (Code Set A)
  31. // ASCII characters 00 to 95 (0–9, A–Z and control codes), special characters, and FNC 1–4
  32. var A_CHARS = exports.A_CHARS = "[\x00-\x5F\xC8-\xCF]";
  33. // 128B (Code Set B)
  34. // ASCII characters 32 to 127 (0–9, A–Z, a–z), special characters, and FNC 1–4
  35. var B_CHARS = exports.B_CHARS = "[\x20-\x7F\xC8-\xCF]";
  36. // 128C (Code Set C)
  37. // 00–99 (encodes two digits with a single code point) and FNC1
  38. var C_CHARS = exports.C_CHARS = "(\xCF*[0-9]{2}\xCF*)";
  39. // CODE128 includes 107 symbols:
  40. // 103 data symbols, 3 start symbols (A, B and C), and 1 stop symbol (the last one)
  41. // Each symbol consist of three black bars (1) and three white spaces (0).
  42. var BARS = exports.BARS = [11011001100, 11001101100, 11001100110, 10010011000, 10010001100, 10001001100, 10011001000, 10011000100, 10001100100, 11001001000, 11001000100, 11000100100, 10110011100, 10011011100, 10011001110, 10111001100, 10011101100, 10011100110, 11001110010, 11001011100, 11001001110, 11011100100, 11001110100, 11101101110, 11101001100, 11100101100, 11100100110, 11101100100, 11100110100, 11100110010, 11011011000, 11011000110, 11000110110, 10100011000, 10001011000, 10001000110, 10110001000, 10001101000, 10001100010, 11010001000, 11000101000, 11000100010, 10110111000, 10110001110, 10001101110, 10111011000, 10111000110, 10001110110, 11101110110, 11010001110, 11000101110, 11011101000, 11011100010, 11011101110, 11101011000, 11101000110, 11100010110, 11101101000, 11101100010, 11100011010, 11101111010, 11001000010, 11110001010, 10100110000, 10100001100, 10010110000, 10010000110, 10000101100, 10000100110, 10110010000, 10110000100, 10011010000, 10011000010, 10000110100, 10000110010, 11000010010, 11001010000, 11110111010, 11000010100, 10001111010, 10100111100, 10010111100, 10010011110, 10111100100, 10011110100, 10011110010, 11110100100, 11110010100, 11110010010, 11011011110, 11011110110, 11110110110, 10101111000, 10100011110, 10001011110, 10111101000, 10111100010, 11110101000, 11110100010, 10111011110, 10111101110, 11101011110, 11110101110, 11010000100, 11010010000, 11010011100, 1100011101011];