Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

runes2.js 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var i;
  2. !function(i) {
  3. i[i.HIGH_SURROGATE_START = 55296] = 'HIGH_SURROGATE_START', i[i.HIGH_SURROGATE_END = 56319] = 'HIGH_SURROGATE_END',
  4. i[i.LOW_SURROGATE_START = 56320] = 'LOW_SURROGATE_START', i[i.REGIONAL_INDICATOR_START = 127462] = 'REGIONAL_INDICATOR_START',
  5. i[i.REGIONAL_INDICATOR_END = 127487] = 'REGIONAL_INDICATOR_END', i[i.FITZPATRICK_MODIFIER_START = 127995] = 'FITZPATRICK_MODIFIER_START',
  6. i[i.FITZPATRICK_MODIFIER_END = 127999] = 'FITZPATRICK_MODIFIER_END', i[i.VARIATION_MODIFIER_START = 65024] = 'VARIATION_MODIFIER_START',
  7. i[i.VARIATION_MODIFIER_END = 65039] = 'VARIATION_MODIFIER_END', i[i.DIACRITICAL_MARKS_START = 8400] = 'DIACRITICAL_MARKS_START',
  8. i[i.DIACRITICAL_MARKS_END = 8447] = 'DIACRITICAL_MARKS_END', i[i.ZWJ = 8205] = 'ZWJ';
  9. }(i || (i = {}));
  10. const t = Object.freeze([ 0x0308, 0x0937, 0x093F, 0x0BA8, 0x0BBF, 0x0BCD, 0x0E31, 0x0E33, 0x0E40, 0x0E49, 0x1100, 0x1161, 0x11A8 ]);
  11. var r;
  12. function runes(i) {
  13. if ('string' != typeof i) throw new TypeError('string cannot be undefined or null');
  14. const t = [];
  15. let r = 0, n = 0;
  16. for (;r < i.length; ) n += nextUnits(r + n, i), isGraphem(i[r + n]) && n++, isVariationSelector(i[r + n]) && n++,
  17. isDiacriticalMark(i[r + n]) && n++, isZeroWidthJoiner(i[r + n]) ? n++ : (t.push(i.substring(r, r + n)),
  18. r += n, n = 0);
  19. return t;
  20. }
  21. function nextUnits(i, t) {
  22. const r = t[i];
  23. if (!isFirstOfSurrogatePair(r) || i === t.length - 1) return 1;
  24. const n = r + t[i + 1];
  25. let e = t.substring(i + 2, i + 5);
  26. return isRegionalIndicator(n) && isRegionalIndicator(e) || isFitzpatrickModifier(e) ? 4 : 2;
  27. }
  28. function isFirstOfSurrogatePair(i) {
  29. return i && betweenInclusive(i[0].charCodeAt(0), 55296, 56319);
  30. }
  31. function isRegionalIndicator(i) {
  32. return betweenInclusive(codePointFromSurrogatePair(i), 127462, 127487);
  33. }
  34. function isFitzpatrickModifier(i) {
  35. return betweenInclusive(codePointFromSurrogatePair(i), 127995, 127999);
  36. }
  37. function isVariationSelector(i) {
  38. return 'string' == typeof i && betweenInclusive(i.charCodeAt(0), 65024, 65039);
  39. }
  40. function isDiacriticalMark(i) {
  41. return 'string' == typeof i && betweenInclusive(i.charCodeAt(0), 8400, 8447);
  42. }
  43. function isGraphem(i) {
  44. return 'string' == typeof i && t.includes(i.charCodeAt(0));
  45. }
  46. function isZeroWidthJoiner(i) {
  47. return 'string' == typeof i && 8205 === i.charCodeAt(0);
  48. }
  49. function codePointFromSurrogatePair(i) {
  50. return (i.charCodeAt(0) - 55296 << 10) + (i.charCodeAt(1) - 56320) + 0x10000;
  51. }
  52. function betweenInclusive(i, t, r) {
  53. return i >= t && i <= r;
  54. }
  55. function substring(i, t, r) {
  56. const n = runes(i);
  57. if (void 0 === t) return i;
  58. if (t >= n.length) return '';
  59. const e = n.length - t;
  60. let o = t + (void 0 === r ? e : r);
  61. return o > t + e && (o = void 0), n.slice(t, o).join('');
  62. }
  63. !function(i) {
  64. i[i.unit_1 = 1] = 'unit_1', i[i.unit_2 = 2] = 'unit_2', i[i.unit_4 = 4] = 'unit_4';
  65. }(r || (r = {}));
  66. export { r as EnumCodeUnits, i as EnumRunesCode, t as GRAPHEMS, betweenInclusive, codePointFromSurrogatePair, runes as default, isDiacriticalMark, isFirstOfSurrogatePair, isFitzpatrickModifier, isGraphem, isRegionalIndicator, isVariationSelector, isZeroWidthJoiner, nextUnits, runes, substring as substr, substring };