@visulima/string 3.0.0-alpha.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/LICENSE.md +119 -0
  3. package/README.md +88 -4
  4. package/dist/align-text.d.ts +35 -0
  5. package/dist/align-text.js +2 -32
  6. package/dist/case/camel-case.d.ts +17 -3
  7. package/dist/case/camel-case.js +1 -55
  8. package/dist/case/capital-case.d.ts +14 -3
  9. package/dist/case/capital-case.js +1 -47
  10. package/dist/case/constant-case.d.ts +14 -3
  11. package/dist/case/constant-case.js +1 -7
  12. package/dist/case/dot-case.d.ts +14 -3
  13. package/dist/case/dot-case.js +1 -7
  14. package/dist/case/flat-case.d.ts +12 -3
  15. package/dist/case/flat-case.js +1 -7
  16. package/dist/case/flip-case.d.ts +16 -3
  17. package/dist/case/flip-case.js +1 -82
  18. package/dist/case/identify-case.d.ts +15 -3
  19. package/dist/case/identify-case.js +1 -65
  20. package/dist/case/index.d.ts +9 -4
  21. package/dist/case/index.js +1 -20
  22. package/dist/case/kebab-case.d.ts +25 -3
  23. package/dist/case/kebab-case.js +1 -55
  24. package/dist/case/lower-first.d.ts +13 -3
  25. package/dist/case/lower-first.js +1 -9
  26. package/dist/case/no-case.d.ts +14 -3
  27. package/dist/case/no-case.js +1 -7
  28. package/dist/case/pascal-case.d.ts +17 -3
  29. package/dist/case/pascal-case.js +1 -48
  30. package/dist/case/pascal-snake-case.d.ts +14 -3
  31. package/dist/case/pascal-snake-case.js +1 -28
  32. package/dist/case/path-case.d.ts +14 -3
  33. package/dist/case/path-case.js +1 -7
  34. package/dist/case/sentence-case.d.ts +14 -3
  35. package/dist/case/sentence-case.js +1 -54
  36. package/dist/case/snake-case.d.ts +14 -3
  37. package/dist/case/snake-case.js +1 -7
  38. package/dist/case/split-by-case.d.ts +29 -3
  39. package/dist/case/split-by-case.js +1 -747
  40. package/dist/case/title-case.d.ts +12 -3
  41. package/dist/case/title-case.js +1 -42
  42. package/dist/case/train-case.d.ts +14 -3
  43. package/dist/case/train-case.js +1 -40
  44. package/dist/case/upper-first.d.ts +13 -3
  45. package/dist/case/upper-first.js +1 -9
  46. package/dist/closest-string.d.ts +32 -0
  47. package/dist/closest-string.js +1 -23
  48. package/dist/compare-similarity.d.ts +37 -0
  49. package/dist/compare-similarity.js +1 -12
  50. package/dist/count-occurrences.d.ts +9 -0
  51. package/dist/count-occurrences.js +1 -0
  52. package/dist/direction.d.ts +7 -0
  53. package/dist/direction.js +1 -0
  54. package/dist/east-asian-width.d.ts +52 -0
  55. package/dist/east-asian-width.js +1 -0
  56. package/dist/excerpt.d.ts +25 -0
  57. package/dist/excerpt.js +53 -0
  58. package/dist/get-string-truncated-width.d.ts +151 -0
  59. package/dist/get-string-truncated-width.js +1 -444
  60. package/dist/get-string-width.d.ts +58 -0
  61. package/dist/get-string-width.js +1 -5
  62. package/dist/indent.d.ts +87 -0
  63. package/dist/indent.js +1 -0
  64. package/dist/index.d.ts +12 -15
  65. package/dist/index.js +1 -39
  66. package/dist/is-fullwidth-code-point.d.ts +7 -0
  67. package/dist/is-fullwidth-code-point.js +1 -0
  68. package/dist/levenshtein.d.ts +25 -0
  69. package/dist/levenshtein.js +1 -0
  70. package/dist/native-string-types.d.ts +239 -0
  71. package/dist/outdent.d.ts +74 -0
  72. package/dist/outdent.js +1 -117
  73. package/dist/packem_shared/_isFullWidth-Dqc3MWgl.js +1 -0
  74. package/dist/packem_shared/closest-C6YDQs4m.js +1 -0
  75. package/dist/packem_shared/constants-aPzGW29R.js +1 -0
  76. package/dist/packem_shared/dedent-CPjAYUXh.js +1 -0
  77. package/dist/packem_shared/eastAsianWidth-DJV8Kqd-.js +1 -0
  78. package/dist/packem_shared/generate-cache-key-BqU1Cqwm.js +1 -0
  79. package/dist/packem_shared/indent-cz8WMI0e.js +1 -0
  80. package/dist/packem_shared/joinSegments-CaHT-45s.js +1 -0
  81. package/dist/packem_shared/lru-cache-BtMSrYQJ.js +1 -0
  82. package/dist/packem_shared/normalize-german-eszett-hNMwtGjd.js +1 -0
  83. package/dist/packem_shared/redent-ByOoJ6fN.js +1 -0
  84. package/dist/packem_shared/types.d-CmNvyl4l.d.ts +360 -0
  85. package/dist/packem_shared/types.d-fhe030jX.d.ts +402 -0
  86. package/dist/replace-string.d.ts +10 -0
  87. package/dist/replace-string.js +1 -0
  88. package/dist/slice.d.ts +42 -0
  89. package/dist/slice.js +1 -413
  90. package/dist/slugify.d.ts +10 -1
  91. package/dist/slugify.js +1 -46
  92. package/dist/test/utils.d.ts +17 -0
  93. package/dist/test/utils.js +13 -88
  94. package/dist/test/vitest.d.ts +3 -0
  95. package/dist/test/vitest.js +1 -5
  96. package/dist/transliterate.d.ts +10 -0
  97. package/dist/transliterate.js +5 -0
  98. package/dist/truncate.d.ts +43 -0
  99. package/dist/truncate.js +1 -114
  100. package/dist/utilities.d.ts +28 -2
  101. package/dist/utilities.js +1 -54
  102. package/dist/word-similarity-sort.d.ts +34 -0
  103. package/dist/word-similarity-sort.js +1 -22
  104. package/dist/word-wrap.d.ts +44 -0
  105. package/dist/word-wrap.js +8 -637
  106. package/package.json +70 -39
  107. package/dist/packem_shared/LRUCache-3r3SovvR.js +0 -46
  108. package/dist/packem_shared/closest-IHuSvnSn.js +0 -139
  109. package/dist/packem_shared/closestN-Cvsw0Fue.js +0 -24
  110. package/dist/packem_shared/constants-D5qaproB.js +0 -95
  111. package/dist/packem_shared/countOccurrences-CS9XprQN.js +0 -22
  112. package/dist/packem_shared/direction-BVhR8MOQ.js +0 -10
  113. package/dist/packem_shared/excerpt-COsVNttN.js +0 -1502
  114. package/dist/packem_shared/generate-cache-key-DdayDfjV.js +0 -6
  115. package/dist/packem_shared/joinSegments-BStLas0c.js +0 -44
  116. package/dist/packem_shared/lru-cache.d-BsP6kbVJ.d.ts +0 -13
  117. package/dist/packem_shared/normalize-german-eszett-DEB8-ZPT.js +0 -7
  118. package/dist/packem_shared/replaceString-BVlxk27d.js +0 -190
  119. package/dist/packem_shared/transliterate-DGlx-woj.js +0 -47756
  120. package/dist/packem_shared/types.d-BVNv675q.d.ts +0 -61
  121. package/dist/packem_shared/types.d-DfgbcNKh.d.ts +0 -57
@@ -1,444 +1 @@
1
- import { i as RE_ANSI, N as RE_CONTROL, j as RE_EMOJI } from './packem_shared/constants-D5qaproB.js';
2
-
3
- const ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
4
- const fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
5
- const halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
6
- const narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
7
- const wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
8
-
9
- const isInRange = (ranges, codePoint) => {
10
- let low = 0;
11
- let high = Math.floor(ranges.length / 2) - 1;
12
- while (low <= high) {
13
- const mid = Math.floor((low + high) / 2);
14
- const i = mid * 2;
15
- if (codePoint < ranges[i]) {
16
- high = mid - 1;
17
- } else if (codePoint > ranges[i + 1]) {
18
- low = mid + 1;
19
- } else {
20
- return true;
21
- }
22
- }
23
- return false;
24
- };
25
-
26
- const minimumAmbiguousCodePoint = ambiguousRanges[0];
27
- const maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
28
- const minimumFullWidthCodePoint = fullwidthRanges[0];
29
- const maximumFullWidthCodePoint = fullwidthRanges.at(-1);
30
- const minimumHalfWidthCodePoint = halfwidthRanges[0];
31
- const maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
32
- const minimumNarrowCodePoint = narrowRanges[0];
33
- const maximumNarrowCodePoint = narrowRanges.at(-1);
34
- const minimumWideCodePoint = wideRanges[0];
35
- const maximumWideCodePoint = wideRanges.at(-1);
36
- const commonCjkCodePoint = 19968;
37
- const [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
38
- function findWideFastPathRange(ranges) {
39
- let fastPathStart = ranges[0];
40
- let fastPathEnd = ranges[1];
41
- for (let index = 0; index < ranges.length; index += 2) {
42
- const start = ranges[index];
43
- const end = ranges[index + 1];
44
- if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
45
- return [start, end];
46
- }
47
- if (end - start > fastPathEnd - fastPathStart) {
48
- fastPathStart = start;
49
- fastPathEnd = end;
50
- }
51
- }
52
- return [fastPathStart, fastPathEnd];
53
- }
54
- const isAmbiguous = (codePoint) => {
55
- if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
56
- return false;
57
- }
58
- return isInRange(ambiguousRanges, codePoint);
59
- };
60
- const isFullWidth = (codePoint) => {
61
- if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
62
- return false;
63
- }
64
- return isInRange(fullwidthRanges, codePoint);
65
- };
66
- const isHalfWidth = (codePoint) => {
67
- if (codePoint < minimumHalfWidthCodePoint || codePoint > maximumHalfWidthCodePoint) {
68
- return false;
69
- }
70
- return isInRange(halfwidthRanges, codePoint);
71
- };
72
- const isNarrow = (codePoint) => {
73
- if (codePoint < minimumNarrowCodePoint || codePoint > maximumNarrowCodePoint) {
74
- return false;
75
- }
76
- return isInRange(narrowRanges, codePoint);
77
- };
78
- const isWide = (codePoint) => {
79
- if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
80
- return true;
81
- }
82
- if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
83
- return false;
84
- }
85
- return isInRange(wideRanges, codePoint);
86
- };
87
- function getCategory(codePoint) {
88
- if (isAmbiguous(codePoint)) {
89
- return "ambiguous";
90
- }
91
- if (isFullWidth(codePoint)) {
92
- return "fullwidth";
93
- }
94
- if (isHalfWidth(codePoint)) {
95
- return "halfwidth";
96
- }
97
- if (isNarrow(codePoint)) {
98
- return "narrow";
99
- }
100
- if (isWide(codePoint)) {
101
- return "wide";
102
- }
103
- return "neutral";
104
- }
105
-
106
- function validate(codePoint) {
107
- if (!Number.isSafeInteger(codePoint)) {
108
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
109
- }
110
- }
111
- function eastAsianWidthType(codePoint) {
112
- validate(codePoint);
113
- return getCategory(codePoint);
114
- }
115
-
116
- const charWidthCache = /* @__PURE__ */ new Map();
117
- const RE_LATIN_CHARS = /(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y;
118
- const getCharType = (codePoint) => {
119
- if (codePoint >= 32 && codePoint <= 126) {
120
- return "latin";
121
- }
122
- if (codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8288) {
123
- return "zero";
124
- }
125
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
126
- return "control";
127
- }
128
- if (codePoint >= 160 && codePoint <= 255) {
129
- return "latin";
130
- }
131
- if (codePoint >= 9472 && codePoint <= 9599) {
132
- return "latin";
133
- }
134
- if (codePoint >= 4352 && codePoint <= 4607 || codePoint >= 11904 && codePoint <= 40959 || codePoint >= 44032 && codePoint <= 55215 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 65280 && codePoint <= 65519 && !(codePoint >= 65377 && codePoint <= 65439) || codePoint >= 12352 && codePoint <= 12543) {
135
- return "wide";
136
- }
137
- if (codePoint === 8230) {
138
- return "latin";
139
- }
140
- return "other";
141
- };
142
- const getCachedCharWidth = (codePoint, config) => {
143
- const highBits = Math.floor(codePoint / 65536);
144
- const lowBits = codePoint % 65536;
145
- let lowMap = charWidthCache.get(highBits);
146
- if (!lowMap) {
147
- lowMap = /* @__PURE__ */ new Map();
148
- charWidthCache.set(highBits, lowMap);
149
- }
150
- if (lowMap.has(lowBits)) {
151
- return lowMap.get(lowBits);
152
- }
153
- let width;
154
- if (getCharType(codePoint) === "latin") {
155
- width = config.width.regular;
156
- } else if (getCharType(codePoint) === "control") {
157
- width = config.width.control;
158
- } else if (getCharType(codePoint) === "wide") {
159
- width = config.width.wide;
160
- } else {
161
- const eaw = eastAsianWidthType(codePoint);
162
- switch (eaw) {
163
- case "ambiguous": {
164
- width = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
165
- break;
166
- }
167
- case "fullwidth": {
168
- width = config.width.fullWidth;
169
- break;
170
- }
171
- case "wide": {
172
- width = config.width.wide;
173
- break;
174
- }
175
- default: {
176
- width = config.width.regular;
177
- }
178
- }
179
- }
180
- lowMap.set(lowBits, width);
181
- return width;
182
- };
183
- const isCombiningCharacter = (codePoint) => {
184
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
185
- return true;
186
- }
187
- if (codePoint >= 917760 && codePoint <= 917999 || codePoint >= 65024 && codePoint <= 65039) {
188
- return true;
189
- }
190
- if (codePoint >= 3633 && codePoint <= 3642 || codePoint >= 3655 && codePoint <= 3662 || codePoint >= 3761 && codePoint <= 3769 || codePoint >= 3771 && codePoint <= 3772 || codePoint >= 3784 && codePoint <= 3789) {
191
- return true;
192
- }
193
- if (codePoint >= 2304 && codePoint <= 2307 || codePoint >= 2362 && codePoint <= 2383 || codePoint >= 2385 && codePoint <= 2391 || codePoint >= 2402 && codePoint <= 2403 || codePoint >= 2433 && codePoint <= 2435 || codePoint >= 2492 && codePoint <= 2500 || codePoint >= 2509 && codePoint <= 2509 || codePoint >= 2561 && codePoint <= 2563 || codePoint >= 2620 && codePoint <= 2637) {
194
- return true;
195
- }
196
- if (codePoint >= 1611 && codePoint <= 1631 || codePoint >= 1648 && codePoint <= 1648 || codePoint >= 1750 && codePoint <= 1773 || codePoint >= 2276 && codePoint <= 2302) {
197
- return true;
198
- }
199
- if (codePoint >= 1425 && codePoint <= 1469 || codePoint >= 1471 && codePoint <= 1471 || codePoint >= 1473 && codePoint <= 1474 || codePoint >= 1476 && codePoint <= 1477 || codePoint >= 1479 && codePoint <= 1479) {
200
- return true;
201
- }
202
- if (codePoint >= 3893 && codePoint <= 3893 || codePoint >= 3895 && codePoint <= 3895 || codePoint >= 3897 && codePoint <= 3897 || codePoint >= 3953 && codePoint <= 3966 || codePoint >= 3968 && codePoint <= 3972 || codePoint >= 3974 && codePoint <= 3975) {
203
- return true;
204
- }
205
- return codePoint >= 768 && codePoint <= 777 || codePoint >= 803 && codePoint <= 803;
206
- };
207
- const getStringTruncatedWidth = (input, options = {}) => {
208
- if (!input || input.length === 0) {
209
- return { ellipsed: false, index: 0, truncated: false, width: 0 };
210
- }
211
- const config = {
212
- truncation: {
213
- countAnsiEscapeCodes: options.countAnsiEscapeCodes ?? false,
214
- ellipsis: options.ellipsis ?? "",
215
- ellipsisWidth: options.ellipsisWidth ?? (options.ellipsis ? getStringTruncatedWidth(options.ellipsis, {
216
- ...options,
217
- ellipsis: "",
218
- ellipsisWidth: 0,
219
- limit: Number.POSITIVE_INFINITY
220
- }).width : 0),
221
- limit: options.limit ?? Number.POSITIVE_INFINITY
222
- },
223
- width: {
224
- ambiguousIsNarrow: options.ambiguousIsNarrow ?? false,
225
- ansi: options.ansiWidth ?? 0,
226
- control: options.controlWidth ?? 0,
227
- emoji: options.emojiWidth ?? 2,
228
- fullWidth: options.fullWidth ?? 2,
229
- halfWidth: options.halfWidth ?? 1,
230
- regular: options.regularWidth ?? 1,
231
- tab: options.tabWidth ?? 8,
232
- wide: options.wideWidth ?? 2
233
- }
234
- };
235
- const truncationLimit = Math.max(0, config.truncation.limit - config.truncation.ellipsisWidth);
236
- const { length } = input;
237
- const useCaching = length > 1e4;
238
- let index = 0;
239
- let width = 0;
240
- let truncationIndex = length;
241
- let truncationEnabled = false;
242
- const hasAnsi = input.includes("\x1B") || input.includes("›");
243
- while (index < length) {
244
- if (hasAnsi && (input[index] === "\x1B" || input[index] === "›")) {
245
- if (input.startsWith("\x1B]8;;", index)) {
246
- const BELL = "\x07";
247
- const OSC8_CLOSER = `\x1B]8;;${BELL}`;
248
- const OSC8_CLOSER_LEN = OSC8_CLOSER.length;
249
- const endOfParametersIndex = input.indexOf(BELL, index + 5);
250
- if (endOfParametersIndex === -1) ; else {
251
- const startOfCloserIndex = input.indexOf(OSC8_CLOSER, endOfParametersIndex + 1);
252
- if (startOfCloserIndex === -1) ; else {
253
- const endOfSequenceIndex = startOfCloserIndex + OSC8_CLOSER_LEN;
254
- const linkText = input.slice(endOfParametersIndex + 1, startOfCloserIndex);
255
- const strippedLinkText = linkText.replace(RE_ANSI, "");
256
- const linkTextWidthResult = getStringTruncatedWidth(strippedLinkText, {
257
- ambiguousIsNarrow: config.width.ambiguousIsNarrow,
258
- ansiWidth: config.width.ansi,
259
- controlWidth: config.width.control,
260
- countAnsiEscapeCodes: false,
261
- // Never count ANSI in link text width
262
- ellipsis: config.truncation.ellipsis,
263
- ellipsisWidth: config.truncation.ellipsisWidth,
264
- emojiWidth: config.width.emoji,
265
- fullWidth: config.width.fullWidth,
266
- halfWidth: config.width.halfWidth,
267
- limit: Math.max(0, truncationLimit - width),
268
- regularWidth: config.width.regular,
269
- tabWidth: config.width.tab,
270
- wideWidth: config.width.wide
271
- });
272
- const textWidth = linkTextWidthResult.width;
273
- if (linkTextWidthResult.truncated) {
274
- truncationEnabled = true;
275
- truncationIndex = Math.min(truncationIndex, index);
276
- } else if (width + textWidth > truncationLimit) {
277
- truncationIndex = Math.min(truncationIndex, index);
278
- truncationEnabled = true;
279
- if (width + textWidth > config.truncation.limit) {
280
- break;
281
- }
282
- }
283
- width += textWidth;
284
- index = endOfSequenceIndex;
285
- if (truncationEnabled && width >= config.truncation.limit) {
286
- break;
287
- }
288
- continue;
289
- }
290
- }
291
- }
292
- RE_ANSI.lastIndex = index;
293
- if (RE_ANSI.test(input)) {
294
- const ansiLength = RE_ANSI.lastIndex - index;
295
- const ansiWidth = config.truncation.countAnsiEscapeCodes ? ansiLength : config.width.ansi;
296
- if (width + ansiWidth > truncationLimit) {
297
- truncationIndex = Math.min(truncationIndex, index);
298
- if (width + ansiWidth > config.truncation.limit) {
299
- truncationEnabled = true;
300
- break;
301
- }
302
- }
303
- width += ansiWidth;
304
- index = RE_ANSI.lastIndex;
305
- continue;
306
- }
307
- }
308
- const charCode = input.codePointAt(index);
309
- if (charCode === 8203 || charCode === 65279 || charCode >= 8288 && charCode <= 8292) {
310
- index += 1;
311
- continue;
312
- }
313
- if (charCode === 9) {
314
- if (width + config.width.tab > truncationLimit) {
315
- truncationIndex = Math.min(truncationIndex, index);
316
- if (width + config.width.tab > config.truncation.limit) {
317
- truncationEnabled = true;
318
- break;
319
- }
320
- }
321
- width += config.width.tab;
322
- index += 1;
323
- continue;
324
- }
325
- RE_LATIN_CHARS.lastIndex = index;
326
- if (RE_LATIN_CHARS.test(input)) {
327
- const latinLength = RE_LATIN_CHARS.lastIndex - index;
328
- const latinWidth = latinLength * config.width.regular;
329
- if (width + latinWidth > truncationLimit) {
330
- const charsToLimit = Math.floor((truncationLimit - width) / config.width.regular);
331
- truncationIndex = Math.min(truncationIndex, index + charsToLimit);
332
- if (width + latinWidth > config.truncation.limit) {
333
- truncationEnabled = true;
334
- break;
335
- }
336
- }
337
- width += latinWidth;
338
- index = RE_LATIN_CHARS.lastIndex;
339
- continue;
340
- }
341
- if (charCode <= 31 || charCode >= 127 && charCode <= 159) {
342
- RE_CONTROL.lastIndex = index;
343
- if (RE_CONTROL.test(input)) {
344
- const controlLength = RE_CONTROL.lastIndex - index;
345
- const controlWidth = controlLength * config.width.control;
346
- if (width + controlWidth > truncationLimit) {
347
- truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / config.width.control));
348
- if (width + controlWidth > config.truncation.limit) {
349
- truncationEnabled = true;
350
- break;
351
- }
352
- }
353
- width += controlWidth;
354
- index = RE_CONTROL.lastIndex;
355
- continue;
356
- }
357
- }
358
- RE_EMOJI.lastIndex = index;
359
- if (RE_EMOJI.test(input)) {
360
- if (width + config.width.emoji > truncationLimit) {
361
- truncationIndex = Math.min(truncationIndex, index);
362
- if (width + config.width.emoji > config.truncation.limit) {
363
- truncationEnabled = true;
364
- break;
365
- }
366
- }
367
- width += config.width.emoji;
368
- index = RE_EMOJI.lastIndex;
369
- continue;
370
- }
371
- const codePoint = input.codePointAt(index) ?? 0;
372
- if (isCombiningCharacter(codePoint)) {
373
- index += codePoint > 65535 ? 2 : 1;
374
- continue;
375
- }
376
- let charWidth;
377
- if (useCaching) {
378
- charWidth = getCachedCharWidth(codePoint, config);
379
- } else {
380
- const charType = getCharType(codePoint);
381
- switch (charType) {
382
- case "control": {
383
- charWidth = config.width.control;
384
- break;
385
- }
386
- case "latin": {
387
- charWidth = config.width.regular;
388
- break;
389
- }
390
- case "wide": {
391
- charWidth = config.width.wide;
392
- break;
393
- }
394
- case "zero": {
395
- charWidth = 0;
396
- break;
397
- }
398
- default: {
399
- const eaw = eastAsianWidthType(codePoint);
400
- switch (eaw) {
401
- case "ambiguous": {
402
- charWidth = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
403
- break;
404
- }
405
- case "fullwidth": {
406
- charWidth = config.width.fullWidth;
407
- break;
408
- }
409
- case "wide": {
410
- charWidth = config.width.wide;
411
- break;
412
- }
413
- default: {
414
- charWidth = config.width.regular;
415
- }
416
- }
417
- }
418
- }
419
- }
420
- if (width + charWidth > truncationLimit) {
421
- truncationIndex = Math.min(truncationIndex, index);
422
- if (width + charWidth > config.truncation.limit) {
423
- truncationEnabled = true;
424
- break;
425
- }
426
- }
427
- width += charWidth;
428
- index += codePoint > 65535 ? 2 : 1;
429
- }
430
- let finalWidth = width;
431
- let ellipsed = false;
432
- if (truncationEnabled && config.truncation.limit >= config.truncation.ellipsisWidth) {
433
- finalWidth = config.truncation.limit;
434
- ellipsed = true;
435
- }
436
- return {
437
- ellipsed,
438
- index: truncationEnabled ? truncationIndex : length,
439
- truncated: truncationEnabled,
440
- width: finalWidth
441
- };
442
- };
443
-
444
- export { getStringTruncatedWidth };
1
+ import{eastAsianWidthType as j}from"./packem_shared/eastAsianWidth-DJV8Kqd-.js";import{R as m,a as b,b as x}from"./packem_shared/constants-aPzGW29R.js";const E=new Map,R=i=>[i.ambiguousIsNarrow?1:0,i.control,i.fullWidth,i.regular,i.wide].join("|"),_=i=>{const t=R(i.width);let e=E.get(t);return e||(e=new Map,E.set(t,e)),e},W=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,O=i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other",B=(i,t)=>{const e=_(t),s=Math.floor(i/65536),h=i%65536;let u=e.get(s);if(u||(u=new Map,e.set(s,u)),u.has(h))return u.get(h);let a;switch(O(i)){case"control":{a=t.width.control;break}case"latin":{a=t.width.regular;break}case"wide":{a=t.width.wide;break}case"zero":{a=0;break}default:switch(j(i)){case"ambiguous":{a=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{a=t.width.fullWidth;break}case"wide":{a=t.width.wide;break}default:a=t.width.regular}}return u.set(h,a),a},P=i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,A=(i,t={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?A(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},s=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:h}=i,u=h>1e4;let a=0,n=0,l=h,r=!1;const T=i.includes("\x1B")||i.includes("›");for(;a<h;){if(T&&(i[a]==="\x1B"||i[a]==="›")){if(i.startsWith("\x1B]8;;",a)){const o="\x1B]8;;\x07",w=o.length,g=i.indexOf("\x07",a+5);if(g!==-1){const I=i.indexOf(o,g+1);if(I!==-1){const C=I+w,F=i.slice(g+1,I).replace(m,""),N=A(F,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,s-n),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),p=N.width;if(N.truncated)r=!0,l=Math.min(l,a);else if(n+p>s&&(l=Math.min(l,a),r=!0,n+p>e.truncation.limit))break;if(n+=p,a=C,r&&n>=e.truncation.limit)break;continue}}}if(m.lastIndex=a,m.test(i)){const o=m.lastIndex-a,w=e.truncation.countAnsiEscapeCodes?o:e.width.ansi;if(n+w>s&&(l=Math.min(l,a),n+w>e.truncation.limit)){r=!0;break}n+=w,a=m.lastIndex;continue}}const c=i.codePointAt(a);if(c===8203||c===65279||c>=8288&&c<=8292){a+=1;continue}if(c===9){if(n+e.width.tab>s&&(l=Math.min(l,a),n+e.width.tab>e.truncation.limit)){r=!0;break}n+=e.width.tab,a+=1;continue}if(W.lastIndex=a,W.test(i)){const o=(W.lastIndex-a)*e.width.regular;if(n+o>s){const w=Math.floor((s-n)/e.width.regular);if(l=Math.min(l,a+w),n+o>e.truncation.limit){r=!0;break}}n+=o,a=W.lastIndex;continue}if((c<=31||c>=127&&c<=159)&&(b.lastIndex=a,b.test(i))){const o=(b.lastIndex-a)*e.width.control;if(n+o>s&&(l=Math.min(l,a+Math.floor((s-n)/e.width.control)),n+o>e.truncation.limit)){r=!0;break}n+=o,a=b.lastIndex;continue}if(x.lastIndex=a,x.test(i)){if(n+e.width.emoji>s&&(l=Math.min(l,a),n+e.width.emoji>e.truncation.limit)){r=!0;break}n+=e.width.emoji,a=x.lastIndex;continue}const f=i.codePointAt(a)??0;if(P(f)){a+=f>65535?2:1;continue}let d;if(u)d=B(f,e);else switch(O(f)){case"control":{d=e.width.control;break}case"latin":{d=e.width.regular;break}case"wide":{d=e.width.wide;break}case"zero":{d=0;break}default:switch(j(f)){case"ambiguous":{d=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{d=e.width.fullWidth;break}case"wide":{d=e.width.wide;break}default:d=e.width.regular}}if(n+d>s&&(l=Math.min(l,a),n+d>e.truncation.limit)){r=!0;break}n+=d,a+=f>65535?2:1}let k=n,M=!1;return r&&e.truncation.limit>=e.truncation.ellipsisWidth&&(k=e.truncation.limit,M=!0),{ellipsed:M,index:r?l:h,truncated:r,width:k}};export{A as getStringTruncatedWidth};
@@ -1,4 +1,62 @@
1
1
  import { StringTruncatedWidthOptions } from "./get-string-truncated-width.js";
2
+ /**
3
+ * Configuration options for string width calculation without truncation support.
4
+ * This type excludes truncation-related options from StringTruncatedWidthOptions.
5
+ * @example
6
+ * ```typescript
7
+ * // Basic usage with defaults
8
+ * const options: StringWidthOptions = {};
9
+ *
10
+ * // Custom character widths
11
+ * const options: StringWidthOptions = {
12
+ * regularWidth: 2,
13
+ * emojiWidth: 3,
14
+ * tabWidth: 4
15
+ * };
16
+ *
17
+ * // Unicode handling options
18
+ * const options: StringWidthOptions = {
19
+ * ambiguousIsNarrow: true,
20
+ * fullWidth: 2,
21
+ * wideWidth: 2
22
+ * };
23
+ * ```
24
+ */
2
25
  type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
26
+ /**
27
+ * Calculate the visual width of a string, taking into account Unicode characters, emojis, and ANSI escape codes.
28
+ * @example
29
+ * ```typescript
30
+ * // Basic usage
31
+ * getStringWidth('hello');
32
+ * // => 5
33
+ *
34
+ * getStringWidth('👋 hello');
35
+ * // => 7
36
+ *
37
+ * // With custom character widths
38
+ * getStringWidth('hello', { regularWidth: 2 });
39
+ * // => 10
40
+ *
41
+ * getStringWidth('あいう', { ambiguousIsNarrow: true });
42
+ * // => 3
43
+ *
44
+ * // With combining characters
45
+ * getStringWidth('e\u0301'); // Latin e with acute
46
+ * // => 1
47
+ *
48
+ * getStringWidth('\u0e01\u0e31'); // Thai character with vowel mark
49
+ * // => 1
50
+ * ```
51
+ *
52
+ * Features:
53
+ * - Full Unicode support including combining marks
54
+ * - Accurate width calculation for emoji sequences
55
+ * - ANSI escape code handling
56
+ * - Customizable character widths
57
+ * @param input The string to calculate the width for
58
+ * @param options Configuration options for width calculation
59
+ * @returns The calculated visual width of the string
60
+ */
3
61
  declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
4
62
  export { StringWidthOptions, getStringWidth };
@@ -1,5 +1 @@
1
- import { getStringTruncatedWidth } from './get-string-truncated-width.js';
2
-
3
- const getStringWidth = (input, options = {}) => getStringTruncatedWidth(input, { ...options, ellipsis: "", ellipsisWidth: 0, limit: Number.POSITIVE_INFINITY }).width;
4
-
5
- export { getStringWidth };
1
+ import{getStringTruncatedWidth as e}from"./get-string-truncated-width.js";const d=(i,t={})=>e(i,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;export{d as getStringWidth};
@@ -0,0 +1,87 @@
1
+ interface Options {
2
+ /**
3
+ The string to use for the indent.
4
+ @default ' '
5
+ */
6
+ readonly indent?: string;
7
+
8
+ /**
9
+ Also indent empty lines.
10
+ @default false
11
+ */
12
+ readonly includeEmptyLines?: boolean;
13
+ }
14
+ /**
15
+ Indent each line in a string.
16
+
17
+ @param string - The string to indent.
18
+ @param count - How many times you want `options.indent` repeated. Default: `1`.
19
+
20
+ @example
21
+ ```
22
+ import indentString from 'indent-string';
23
+
24
+ indentString('Unicorns\nRainbows', 4);
25
+ //=> ' Unicorns\n Rainbows'
26
+
27
+ indentString('Unicorns\nRainbows', 4, {indent: '♥'});
28
+ //=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
29
+ ```
30
+ */
31
+ declare function indentString(string: string, count?: number, options?: Options): string;
32
+ /**
33
+ [Strip redundant indentation](https://github.com/sindresorhus/strip-indent) and [indent the string](https://github.com/sindresorhus/indent-string).
34
+
35
+ @param string - The string to normalize indentation.
36
+ @param count - How many times you want `options.indent` repeated. Default: `0`.
37
+
38
+ @example
39
+ ```
40
+ import redent from 'redent';
41
+
42
+ redent('\n foo\n bar\n', 1);
43
+ //=> '\n foo\n bar\n'
44
+ ```
45
+ */
46
+ declare function redent(string: string, count?: number, options?: Options): string;
47
+ /**
48
+ Strip leading whitespace from each line in a string.
49
+
50
+ The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.
51
+
52
+ @example
53
+ ```
54
+ import stripIndent from 'strip-indent';
55
+
56
+ const string = '\tunicorn\n\t\tcake';
57
+ // unicorn
58
+ // cake
59
+
60
+ stripIndent(string);
61
+ //unicorn
62
+ // cake
63
+ ```
64
+ */
65
+ declare function stripIndent(string: string): string;
66
+ /**
67
+ Strip leading whitespace from each line in a string and remove surrounding blank lines.
68
+
69
+ The line with the least number of leading whitespace, ignoring empty lines, determines the number to remove.
70
+ Leading and trailing lines that contain only whitespace are removed.
71
+
72
+ Useful for template literals and multi-line strings where you want clean boundaries.
73
+
74
+ @example
75
+ ```
76
+ import {dedent} from 'strip-indent';
77
+
78
+ dedent(`
79
+ unicorn
80
+ cake
81
+ `);
82
+ //unicorn
83
+ // cake
84
+ ```
85
+ */
86
+ declare function dedent(string: string): string;
87
+ export { type Options as IndentOptions, dedent, indentString as indent, redent, stripIndent };
package/dist/indent.js ADDED
@@ -0,0 +1 @@
1
+ import{default as d}from"./packem_shared/indent-cz8WMI0e.js";import{default as a}from"./packem_shared/redent-ByOoJ6fN.js";import{dedent as n,default as o}from"./packem_shared/dedent-CPjAYUXh.js";export{n as dedent,d as indent,a as redent,o as stripIndent};
package/dist/index.d.ts CHANGED
@@ -17,30 +17,27 @@ export { default as snakeCase } from "./case/snake-case.js";
17
17
  export { type SplitOptions, splitByCase } from "./case/split-by-case.js";
18
18
  export { default as titleCase } from "./case/title-case.js";
19
19
  export { default as trainCase } from "./case/train-case.js";
20
- export { type a as CamelCase, type b as CapitalCase, type C as CaseOptions, type c as ConstantCase, type D as DotCase, type F as FlatCase, type d as FlipCase, type I as IdentifyCase, type K as KebabCase, type L as LocaleOptions, type e as LowerFirst, type N as NoCase, type P as PascalCase, type f as PascalSnakeCase, type g as PathCase, type S as SentenceCase, type h as SnakeCase, type i as SplitByCase, type T as TitleCase, type j as TrainCase, type U as UpperFirst } from "./packem_shared/types.d-DfgbcNKh.js";
20
+ export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "./packem_shared/types.d-fhe030jX.js";
21
21
  export { default as upperFirst } from "./case/upper-first.js";
22
22
  export { joinSegments } from "./case/index.js";
23
23
  export { type ClosestStringOptions, closestString } from "./closest-string.js";
24
24
  export { type CompareSimilarityOptions, compareSimilarity } from "./compare-similarity.js";
25
- import { TruncateOptions } from "./truncate.js";
26
- export { truncate } from "./truncate.js";
25
+ export { countOccurrences } from "./count-occurrences.js";
26
+ export { direction } from "./direction.js";
27
+ export { type EastAsianWidthOptions, type EastAsianWidthType, eastAsianWidth, eastAsianWidthType } from "./east-asian-width.js";
28
+ export { type ExcerptOptions, excerpt } from "./excerpt.js";
27
29
  export { type StringTruncatedWidthOptions, type StringTruncatedWidthResult, getStringTruncatedWidth } from "./get-string-truncated-width.js";
28
30
  export { type StringWidthOptions, getStringWidth } from "./get-string-width.js";
31
+ export { type IndentOptions, dedent, indent, redent, stripIndent } from "./indent.js";
32
+ export { default as isFullwidthCodePoint } from "./is-fullwidth-code-point.js";
33
+ export { closest, closestN, distance, similarity } from "./levenshtein.js";
29
34
  export { type Outdent, type Options as OutdentOptions, outdent } from "./outdent.js";
30
- import { O as OptionReplaceArray, a as IntervalArray, b as OptionsTransliterate } from "./packem_shared/types.d-BVNv675q.js";
31
- export { type A as All, type c as Any, type C as CharAt, type d as Charmap, type e as Concat, type E as EndsWith, type f as Includes, type g as Interval, type h as IsBooleanLiteral, type i as IsNumberLiteral, type I as IsStringLiteral, type j as IsStringLiteralArray, type J as Join, type L as Length, type M as Math, type N as NodeLocale, type k as OptionReplaceCombined, type l as OptionReplaceObject, type P as PadEnd, type m as PadStart, type R as Repeat, type n as Replace, type o as ReplaceAll, type p as Reverse, type q as Slice, type S as SlugifyOptions, type r as Split, type s as StartsWith, type T as ToLowerCase, type t as ToUpperCase, type u as Trim, type v as TrimEnd, type w as TrimStart } from "./packem_shared/types.d-BVNv675q.js";
35
+ export { default as replaceString } from "./replace-string.js";
32
36
  export { type SliceOptions, slice } from "./slice.js";
33
37
  export { default as slugify } from "./slugify.js";
38
+ export { default as transliterate } from "./transliterate.js";
39
+ export { type TruncateOptions, truncate } from "./truncate.js";
40
+ export type { A as All, a as Any, C as CharAt, b as Charmap, c as Concat, E as EndsWith, I as Includes, d as Interval, e as IntervalArray, f as IsBooleanLiteral, g as IsNumberLiteral, h as IsStringLiteral, i as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, O as OptionReplaceArray, j as OptionReplaceCombined, k as OptionReplaceObject, l as OptionsTransliterate, P as PadEnd, m as PadStart, R as Repeat, n as Replace, o as ReplaceAll, p as Reverse, S as Slice, q as SlugifyOptions, r as Split, s as StartsWith, T as ToLowerCase, t as ToUpperCase, u as Trim, v as TrimEnd, w as TrimStart } from "./packem_shared/types.d-CmNvyl4l.js";
34
41
  export { escapeRegExp, findStringOccurrences, hasChinese, hasPunctuationOrSpace, inRange } from "./utilities.js";
35
42
  export { type WordSimilaritySortOptions, wordSimilaritySort } from "./word-similarity-sort.js";
36
43
  export { type WordWrapOptions, WrapMode, wordWrap } from "./word-wrap.js";
37
- export { closest, distance } from 'fastest-levenshtein';
38
- import "./packem_shared/lru-cache.d-BsP6kbVJ.js";
39
- declare const countOccurrences: (value: string, substring: string) => number;
40
- declare const direction: (value: string) => "rtl" | "ltr" | "neutral";
41
- declare const excerpt: (html: string, limit: number, options?: ExcerptOptions) => string;
42
- type ExcerptOptions = Omit<TruncateOptions, "position">;
43
- declare const closestN: (string_: string, array: ReadonlyArray<string>, n: number) => (string | undefined)[];
44
- declare const replaceString: (source: string, searches: OptionReplaceArray, ignoreRanges: IntervalArray) => string;
45
- declare const transliterate: (source: string, options?: OptionsTransliterate) => string;
46
- export { type ExcerptOptions, type IntervalArray, type OptionReplaceArray, type OptionsTransliterate, type TruncateOptions, closestN, countOccurrences, direction, excerpt, replaceString, transliterate };