@visulima/string 3.0.0-alpha.10 → 3.0.0-alpha.12

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 (114) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE.md +68 -3
  3. package/dist/align-text.d.ts +35 -0
  4. package/dist/align-text.js +2 -34
  5. package/dist/case/camel-case.d.ts +17 -2
  6. package/dist/case/camel-case.js +1 -55
  7. package/dist/case/capital-case.d.ts +14 -2
  8. package/dist/case/capital-case.js +1 -47
  9. package/dist/case/constant-case.d.ts +14 -2
  10. package/dist/case/constant-case.js +1 -7
  11. package/dist/case/dot-case.d.ts +14 -2
  12. package/dist/case/dot-case.js +1 -7
  13. package/dist/case/flat-case.d.ts +12 -2
  14. package/dist/case/flat-case.js +1 -7
  15. package/dist/case/flip-case.d.ts +16 -2
  16. package/dist/case/flip-case.js +1 -82
  17. package/dist/case/identify-case.d.ts +15 -2
  18. package/dist/case/identify-case.js +1 -66
  19. package/dist/case/index.d.ts +8 -2
  20. package/dist/case/index.js +1 -20
  21. package/dist/case/kebab-case.d.ts +25 -2
  22. package/dist/case/kebab-case.js +1 -55
  23. package/dist/case/lower-first.d.ts +13 -2
  24. package/dist/case/lower-first.js +1 -9
  25. package/dist/case/no-case.d.ts +14 -2
  26. package/dist/case/no-case.js +1 -7
  27. package/dist/case/pascal-case.d.ts +17 -2
  28. package/dist/case/pascal-case.js +1 -48
  29. package/dist/case/pascal-snake-case.d.ts +14 -2
  30. package/dist/case/pascal-snake-case.js +1 -28
  31. package/dist/case/path-case.d.ts +14 -2
  32. package/dist/case/path-case.js +1 -7
  33. package/dist/case/sentence-case.d.ts +14 -2
  34. package/dist/case/sentence-case.js +1 -54
  35. package/dist/case/snake-case.d.ts +14 -2
  36. package/dist/case/snake-case.js +1 -7
  37. package/dist/case/split-by-case.d.ts +29 -2
  38. package/dist/case/split-by-case.js +1 -763
  39. package/dist/case/title-case.d.ts +12 -2
  40. package/dist/case/title-case.js +1 -40
  41. package/dist/case/train-case.d.ts +14 -2
  42. package/dist/case/train-case.js +1 -40
  43. package/dist/case/upper-first.d.ts +13 -2
  44. package/dist/case/upper-first.js +1 -9
  45. package/dist/closest-string.d.ts +32 -0
  46. package/dist/closest-string.js +1 -22
  47. package/dist/compare-similarity.d.ts +38 -1
  48. package/dist/compare-similarity.js +1 -12
  49. package/dist/get-string-truncated-width.d.ts +151 -0
  50. package/dist/get-string-truncated-width.js +1 -332
  51. package/dist/get-string-width.d.ts +58 -0
  52. package/dist/get-string-width.js +1 -5
  53. package/dist/index.d.ts +194 -9
  54. package/dist/index.js +1 -44
  55. package/dist/native-string-types.d.ts +239 -0
  56. package/dist/outdent.d.ts +74 -0
  57. package/dist/outdent.js +1 -109
  58. package/dist/packem_shared/LRUCache-Bjo6gsbC.js +1 -0
  59. package/dist/packem_shared/closest-uarbVSbs.js +1 -0
  60. package/dist/packem_shared/closestN-Vd5oNJy_.js +1 -0
  61. package/dist/packem_shared/constants-DmzZF6_u.js +1 -0
  62. package/dist/packem_shared/countOccurrences-DIHSCdcG.js +1 -0
  63. package/dist/packem_shared/direction-dtczwUOE.js +1 -0
  64. package/dist/packem_shared/eastAsianWidthType-lcBsj7vg.js +1 -0
  65. package/dist/packem_shared/excerpt-DhV2yoHG.js +54 -0
  66. package/dist/packem_shared/generate-cache-key-DPByFaMH.js +1 -0
  67. package/dist/packem_shared/indent-CDlPQmpe.js +1 -0
  68. package/dist/packem_shared/isFullwidthCodePoint-Dmsf2-5L.js +1 -0
  69. package/dist/packem_shared/joinSegments-D27SxoCV.js +1 -0
  70. package/dist/packem_shared/lookup-ChWuUpyb.js +1 -0
  71. package/dist/packem_shared/normalize-german-eszett-AKfdw2MZ.js +1 -0
  72. package/dist/packem_shared/redent-BECVOaZp.js +1 -0
  73. package/dist/packem_shared/replaceString-aq-C7Wor.js +1 -0
  74. package/dist/packem_shared/stripIndent-Dt8hSxVM.js +1 -0
  75. package/dist/packem_shared/transliterate-D1p1yYE7.js +5 -0
  76. package/dist/packem_shared/types.d-FOLSY2Tc.d.ts +392 -0
  77. package/dist/packem_shared/types.d-NJ4vcG-A.d.ts +346 -0
  78. package/dist/slice.d.ts +42 -0
  79. package/dist/slice.js +1 -415
  80. package/dist/slugify.d.ts +10 -1
  81. package/dist/slugify.js +1 -46
  82. package/dist/test/utils.d.ts +17 -0
  83. package/dist/test/utils.js +13 -88
  84. package/dist/test/vitest.d.ts +3 -0
  85. package/dist/test/vitest.js +1 -5
  86. package/dist/truncate.d.ts +43 -0
  87. package/dist/truncate.js +1 -112
  88. package/dist/utilities.d.ts +28 -1
  89. package/dist/utilities.js +1 -52
  90. package/dist/word-similarity-sort.d.ts +34 -0
  91. package/dist/word-similarity-sort.js +1 -22
  92. package/dist/word-wrap.d.ts +44 -0
  93. package/dist/word-wrap.js +8 -639
  94. package/package.json +46 -46
  95. package/dist/packem_shared/LRUCache-3r3SovvR.js +0 -46
  96. package/dist/packem_shared/closest-IHuSvnSn.js +0 -139
  97. package/dist/packem_shared/closestN-DUsjgiXb.js +0 -25
  98. package/dist/packem_shared/constants-BsZS5f0z.js +0 -95
  99. package/dist/packem_shared/countOccurrences-CS9XprQN.js +0 -22
  100. package/dist/packem_shared/direction-C9gfWWTK.js +0 -16
  101. package/dist/packem_shared/eastAsianWidthType-SD3YniiT.js +0 -20
  102. package/dist/packem_shared/excerpt-COsVNttN.js +0 -1502
  103. package/dist/packem_shared/generate-cache-key-DdayDfjV.js +0 -6
  104. package/dist/packem_shared/indent-D3DSCa6s.js +0 -33
  105. package/dist/packem_shared/isFullwidthCodePoint-IFXZxNjq.js +0 -10
  106. package/dist/packem_shared/joinSegments-CvxSgKz0.js +0 -44
  107. package/dist/packem_shared/lookup-BE8lEqy4.js +0 -104
  108. package/dist/packem_shared/normalize-german-eszett-4p3yKEzn.js +0 -8
  109. package/dist/packem_shared/redent-DSb1IJWn.js +0 -8
  110. package/dist/packem_shared/replaceString-Ce8X2ZQ-.js +0 -192
  111. package/dist/packem_shared/stripIndent-D_TRjxZ_.js +0 -20
  112. package/dist/packem_shared/transliterate-CKt9VK7D.js +0 -47756
  113. package/dist/packem_shared/types.d-BVNv675q.d.ts +0 -61
  114. package/dist/packem_shared/types.d-DfgbcNKh.d.ts +0 -57
package/package.json CHANGED
@@ -1,59 +1,64 @@
1
1
  {
2
2
  "name": "@visulima/string",
3
- "version": "3.0.0-alpha.10",
3
+ "version": "3.0.0-alpha.12",
4
4
  "description": "Functions for manipulating strings.",
5
5
  "keywords": [
6
- "visulima",
7
6
  "align",
8
7
  "align-text",
9
- "align-text-left",
10
8
  "align-text-center",
11
- "align-text-right",
12
9
  "align-text-justify",
10
+ "align-text-left",
11
+ "align-text-right",
13
12
  "align-text-start",
14
- "string",
15
- "string-manipulation",
16
- "unicode",
17
- "text-processing",
18
- "i18n",
19
- "internationalization",
13
+ "ansi-styles",
14
+ "camelcase",
15
+ "capitalcase",
16
+ "case-conversion",
20
17
  "cjk",
18
+ "constantcase",
19
+ "dotcase",
21
20
  "east-asian-width",
21
+ "flatcase",
22
22
  "grapheme-splitter",
23
- "ansi-styles",
24
- "text-slicing",
25
- "text-truncation",
26
- "case-conversion",
27
- "camelcase",
28
- "pascalcase",
29
- "snakecase",
23
+ "i18n",
24
+ "internationalization",
30
25
  "kebabcase",
31
- "dotcase",
26
+ "lowercase",
27
+ "nocase",
28
+ "pascalcase",
32
29
  "pathcase",
33
- "titlecase",
30
+ "romanization",
34
31
  "sentencecase",
35
- "constantcase",
36
- "flatcase",
37
- "capitalcase",
38
- "nocase",
39
- "uppercase",
40
- "lowercase",
32
+ "slug",
33
+ "slugify",
34
+ "snakecase",
35
+ "string",
36
+ "string-manipulation",
41
37
  "string-splitting",
42
- "typescript",
43
- "type-safe",
38
+ "text-processing",
39
+ "text-slicing",
40
+ "text-truncation",
44
41
  "thai",
45
- "romanization",
46
- "transliteration",
47
42
  "thai-romanization",
48
- "slug",
49
- "slugify",
43
+ "titlecase",
44
+ "transliteration",
45
+ "type-safe",
46
+ "typescript",
47
+ "unicode",
48
+ "uppercase",
49
+ "utf-8",
50
50
  "utf8",
51
- "utf-8"
51
+ "visulima"
52
52
  ],
53
53
  "homepage": "https://visulima.com/packages/string",
54
54
  "bugs": {
55
55
  "url": "https://github.com/visulima/visulima/issues"
56
56
  },
57
+ "license": "MIT",
58
+ "author": {
59
+ "name": "Daniel Bannert",
60
+ "email": "d.bannert@anolilab.de"
61
+ },
57
62
  "repository": {
58
63
  "type": "git",
59
64
  "url": "git+https://github.com/visulima/visulima.git",
@@ -69,13 +74,13 @@
69
74
  "url": "https://anolilab.com/support"
70
75
  }
71
76
  ],
72
- "license": "MIT",
73
- "author": {
74
- "name": "Daniel Bannert",
75
- "email": "d.bannert@anolilab.de"
76
- },
77
- "sideEffects": false,
77
+ "files": [
78
+ "dist",
79
+ "README.md",
80
+ "CHANGELOG.md"
81
+ ],
78
82
  "type": "module",
83
+ "sideEffects": false,
79
84
  "exports": {
80
85
  "./native-string-types": {
81
86
  "types": "./dist/native-string-types.d.ts"
@@ -222,16 +227,11 @@
222
227
  },
223
228
  "./package.json": "./package.json"
224
229
  },
225
- "files": [
226
- "dist",
227
- "README.md",
228
- "CHANGELOG.md"
229
- ],
230
- "engines": {
231
- "node": "^22.14.0 || >=24.10.0"
232
- },
233
230
  "publishConfig": {
234
231
  "access": "public",
235
232
  "provenance": true
233
+ },
234
+ "engines": {
235
+ "node": "^22.14.0 || >=24.10.0"
236
236
  }
237
237
  }
@@ -1,46 +0,0 @@
1
- class LRUCache {
2
- capacity;
3
- cache;
4
- keyOrder;
5
- constructor(capacity) {
6
- this.capacity = capacity;
7
- this.cache = /* @__PURE__ */ new Map();
8
- this.keyOrder = [];
9
- }
10
- get(key) {
11
- if (!this.cache.has(key)) {
12
- return void 0;
13
- }
14
- this.keyOrder = this.keyOrder.filter((k) => k !== key);
15
- this.keyOrder.push(key);
16
- return this.cache.get(key);
17
- }
18
- has(key) {
19
- return this.cache.has(key);
20
- }
21
- set(key, value) {
22
- if (this.cache.has(key)) {
23
- this.keyOrder = this.keyOrder.filter((k) => k !== key);
24
- } else if (this.cache.size >= this.capacity) {
25
- const lruKey = this.keyOrder.shift();
26
- if (lruKey !== void 0) {
27
- this.cache.delete(lruKey);
28
- }
29
- }
30
- this.cache.set(key, value);
31
- this.keyOrder.push(key);
32
- }
33
- delete(key) {
34
- this.cache.delete(key);
35
- this.keyOrder = this.keyOrder.filter((k) => k !== key);
36
- }
37
- clear() {
38
- this.cache.clear();
39
- this.keyOrder = [];
40
- }
41
- size() {
42
- return this.cache.size;
43
- }
44
- }
45
-
46
- export { LRUCache as default };
@@ -1,139 +0,0 @@
1
- const peq = new Uint32Array(65536);
2
- const myers_32 = (a, b) => {
3
- const n = a.length;
4
- const m = b.length;
5
- const lst = 1 << n - 1;
6
- let pv = -1;
7
- let mv = 0;
8
- let sc = n;
9
- let i = n;
10
- while (i--) {
11
- peq[a.charCodeAt(i)] |= 1 << i;
12
- }
13
- for (i = 0; i < m; i++) {
14
- let eq = peq[b.charCodeAt(i)];
15
- const xv = eq | mv;
16
- eq |= (eq & pv) + pv ^ pv;
17
- mv |= ~(eq | pv);
18
- pv &= eq;
19
- if (mv & lst) {
20
- sc++;
21
- }
22
- if (pv & lst) {
23
- sc--;
24
- }
25
- mv = mv << 1 | 1;
26
- pv = pv << 1 | ~(xv | mv);
27
- mv &= xv;
28
- }
29
- i = n;
30
- while (i--) {
31
- peq[a.charCodeAt(i)] = 0;
32
- }
33
- return sc;
34
- };
35
- const myers_x = (b, a) => {
36
- const n = a.length;
37
- const m = b.length;
38
- const mhc = [];
39
- const phc = [];
40
- const hsize = Math.ceil(n / 32);
41
- const vsize = Math.ceil(m / 32);
42
- for (let i = 0; i < hsize; i++) {
43
- phc[i] = -1;
44
- mhc[i] = 0;
45
- }
46
- let j = 0;
47
- for (; j < vsize - 1; j++) {
48
- let mv2 = 0;
49
- let pv2 = -1;
50
- const start2 = j * 32;
51
- const vlen2 = Math.min(32, m) + start2;
52
- for (let k = start2; k < vlen2; k++) {
53
- peq[b.charCodeAt(k)] |= 1 << k;
54
- }
55
- for (let i = 0; i < n; i++) {
56
- const eq = peq[a.charCodeAt(i)];
57
- const pb = phc[i / 32 | 0] >>> i & 1;
58
- const mb = mhc[i / 32 | 0] >>> i & 1;
59
- const xv = eq | mv2;
60
- const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb;
61
- let ph = mv2 | ~(xh | pv2);
62
- let mh = pv2 & xh;
63
- if (ph >>> 31 ^ pb) {
64
- phc[i / 32 | 0] ^= 1 << i;
65
- }
66
- if (mh >>> 31 ^ mb) {
67
- mhc[i / 32 | 0] ^= 1 << i;
68
- }
69
- ph = ph << 1 | pb;
70
- mh = mh << 1 | mb;
71
- pv2 = mh | ~(xv | ph);
72
- mv2 = ph & xv;
73
- }
74
- for (let k = start2; k < vlen2; k++) {
75
- peq[b.charCodeAt(k)] = 0;
76
- }
77
- }
78
- let mv = 0;
79
- let pv = -1;
80
- const start = j * 32;
81
- const vlen = Math.min(32, m - start) + start;
82
- for (let k = start; k < vlen; k++) {
83
- peq[b.charCodeAt(k)] |= 1 << k;
84
- }
85
- let score = m;
86
- for (let i = 0; i < n; i++) {
87
- const eq = peq[a.charCodeAt(i)];
88
- const pb = phc[i / 32 | 0] >>> i & 1;
89
- const mb = mhc[i / 32 | 0] >>> i & 1;
90
- const xv = eq | mv;
91
- const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
92
- let ph = mv | ~(xh | pv);
93
- let mh = pv & xh;
94
- score += ph >>> m - 1 & 1;
95
- score -= mh >>> m - 1 & 1;
96
- if (ph >>> 31 ^ pb) {
97
- phc[i / 32 | 0] ^= 1 << i;
98
- }
99
- if (mh >>> 31 ^ mb) {
100
- mhc[i / 32 | 0] ^= 1 << i;
101
- }
102
- ph = ph << 1 | pb;
103
- mh = mh << 1 | mb;
104
- pv = mh | ~(xv | ph);
105
- mv = ph & xv;
106
- }
107
- for (let k = start; k < vlen; k++) {
108
- peq[b.charCodeAt(k)] = 0;
109
- }
110
- return score;
111
- };
112
- const distance = (a, b) => {
113
- if (a.length < b.length) {
114
- const tmp = b;
115
- b = a;
116
- a = tmp;
117
- }
118
- if (b.length === 0) {
119
- return a.length;
120
- }
121
- if (a.length <= 32) {
122
- return myers_32(a, b);
123
- }
124
- return myers_x(a, b);
125
- };
126
- const closest = (str, arr) => {
127
- let min_distance = Infinity;
128
- let min_index = 0;
129
- for (let i = 0; i < arr.length; i++) {
130
- const dist = distance(str, arr[i]);
131
- if (dist < min_distance) {
132
- min_distance = dist;
133
- min_index = i;
134
- }
135
- }
136
- return arr[min_index];
137
- };
138
-
139
- export { closest, distance };
@@ -1,25 +0,0 @@
1
- import { distance } from './closest-IHuSvnSn.js';
2
- export { closest } from './closest-IHuSvnSn.js';
3
-
4
- const closestN = (string_, array, n) => {
5
- const distances = Array.from({ length: n }).fill(Infinity);
6
- const values = Array.from({ length: n }).fill(void 0);
7
- for (const element of array) {
8
- const candidateValue = element;
9
- let currentDistance = distance(string_, candidateValue);
10
- let currentValue = candidateValue;
11
- for (let index = 0; index < n; index += 1) {
12
- if (currentDistance < distances[index]) {
13
- const temporaryDistance = distances[index];
14
- const temporaryValue = values[index];
15
- distances[index] = currentDistance;
16
- values[index] = currentValue;
17
- currentDistance = temporaryDistance;
18
- currentValue = temporaryValue ?? "";
19
- }
20
- }
21
- }
22
- return values;
23
- };
24
-
25
- export { closestN, distance };
@@ -1,95 +0,0 @@
1
- const r = String.raw;
2
- const e = r`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`;
3
- const emojiRegex = () => new RegExp(r`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${e}(?:\u200D${e})*`, "gu");
4
-
5
- const ESCAPES = /* @__PURE__ */ new Set(["\x1B", "›"]);
6
- const ANSI_ESCAPE_BELL = "\x07";
7
- const ANSI_CSI = "[";
8
- const ANSI_SGR_TERMINATOR = "m";
9
- const ANSI_ESCAPE_LINK = `]8;;`;
10
- const END_CODE = 39;
11
- const RE_ZERO_WIDTH = /[\u200B\uFEFF\u2060-\u2064]/g;
12
- const RE_ESCAPE_PATTERN = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`);
13
- const ANSI_RESET_CODES = Object.freeze(
14
- /* @__PURE__ */ new Map([
15
- [0, 0],
16
- // Reset all
17
- [1, 22],
18
- // Bold → Not bold
19
- [2, 22],
20
- // Dim → Not bold
21
- [3, 23],
22
- // Italic → Not italic
23
- [4, 24],
24
- // Underline → Not underline
25
- [7, 27],
26
- // Inverse → Not inverse
27
- [8, 28],
28
- // Hidden → Not hidden
29
- [9, 29],
30
- // Strikethrough → Not strikethrough
31
- [30, 39],
32
- // Foreground colors → Default foreground
33
- [31, 39],
34
- [32, 39],
35
- [33, 39],
36
- [34, 39],
37
- [35, 39],
38
- [36, 39],
39
- [37, 39],
40
- [40, 49],
41
- // Background colors → Default background
42
- [41, 49],
43
- [42, 49],
44
- [43, 49],
45
- [44, 49],
46
- [45, 49],
47
- [46, 49],
48
- [47, 49],
49
- [90, 39]
50
- // Bright foreground → Default foreground
51
- ])
52
- );
53
- const RE_LEADING_NEWLINE = /^[ \t]*(?:\r\n|\r|\n)/;
54
- const RE_TRAILING_NEWLINE = /(?:\r\n|\r|\n)[ \t]*$/;
55
- const RE_STARTS_WITH_NEWLINE_OR_IS_EMPTY = /^(?:[\r\n]|$)/;
56
- const RE_DETECT_INDENTATION = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
57
- const RE_ONLY_WHITESPACE_WITH_AT_LEAST_ONE_NEWLINE = /^[ \t]*[\r\n][ \t\r\n]*$/;
58
- const RE_MATCH_NEWLINES = /\r\n|\n|\r/g;
59
- const RE_ANSI = /[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g;
60
- const RE_VALID_ANSI_PAIRS = /\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g;
61
- const RE_VALID_HYPERLINKS = /\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g;
62
- const RE_CONTROL = /[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y;
63
- const RE_EMOJI = emojiRegex();
64
- const RE_SEPARATORS = /[-_./\s]+/g;
65
- const RE_FAST_ANSI = /(\u001B\[[0-9;]*[a-z])/i;
66
- const RE_ARABIC = new RegExp("\\p{Script=Arabic}", "u");
67
- const RE_BENGALI = new RegExp("\\p{Script=Bengali}", "u");
68
- const RE_CYRILLIC = new RegExp("\\p{Script=Cyrillic}", "u");
69
- const RE_DEVANAGARI = new RegExp("\\p{Script=Devanagari}", "u");
70
- const RE_ETHIOPIC = new RegExp("\\p{Script=Ethiopic}", "u");
71
- const RE_GREEK = new RegExp("\\p{Script=Greek}", "u");
72
- const RE_GREEK_LATIN_SPLIT = new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+", "gu");
73
- const RE_GUJARATI = new RegExp("\\p{Script=Gujarati}", "u");
74
- const RE_GURMUKHI = new RegExp("\\p{Script=Gurmukhi}", "u");
75
- const RE_HANGUL = new RegExp("\\p{Script=Hangul}", "u");
76
- const RE_HEBREW = new RegExp("\\p{Script=Hebrew}", "u");
77
- const RE_HIRAGANA = new RegExp("\\p{Script=Hiragana}", "u");
78
- const RE_KANJI = new RegExp("\\p{Script=Han}", "u");
79
- const RE_KANNADA = new RegExp("\\p{Script=Kannada}", "u");
80
- const RE_KATAKANA = new RegExp("\\p{Script=Katakana}", "u");
81
- const RE_KHMER = new RegExp("\\p{Script=Khmer}", "u");
82
- const RE_LAO = new RegExp("\\p{Script=Lao}", "u");
83
- const RE_LATIN = new RegExp("\\p{Script=Latin}", "u");
84
- const RE_MALAYALAM = new RegExp("\\p{Script=Malayalam}", "u");
85
- const RE_MYANMAR = new RegExp("\\p{Script=Myanmar}", "u");
86
- const RE_ORIYA = new RegExp("\\p{Script=Oriya}", "u");
87
- const RE_SINHALA = new RegExp("\\p{Script=Sinhala}", "u");
88
- const RE_TAMIL = new RegExp("\\p{Script=Tamil}", "u");
89
- const RE_TELUGU = new RegExp("\\p{Script=Telugu}", "u");
90
- const RE_THAI = new RegExp("\\p{Script=Thai}", "u");
91
- const RE_TIBETAN = new RegExp("\\p{Script=Tibetan}", "u");
92
- const RE_UZBEK_LATIN_MODIFIER = /[\u02BB\u02BC\u0027]/u;
93
- const stripEmoji = (stringValue) => stringValue.replace(RE_EMOJI, "");
94
-
95
- export { RE_GUJARATI as A, RE_GURMUKHI as B, RE_KANNADA as C, RE_TAMIL as D, RE_TELUGU as E, RE_MALAYALAM as F, RE_SINHALA as G, RE_THAI as H, RE_LAO as I, RE_TIBETAN as J, RE_MYANMAR as K, RE_ETHIOPIC as L, RE_KHMER as M, RE_ORIYA as N, ESCAPES as O, ANSI_ESCAPE_LINK as P, ANSI_SGR_TERMINATOR as Q, RE_FAST_ANSI as R, ANSI_ESCAPE_BELL as S, ANSI_CSI as T, RE_ESCAPE_PATTERN as U, ANSI_RESET_CODES as V, END_CODE as W, RE_ZERO_WIDTH as X, RE_LEADING_NEWLINE as a, RE_TRAILING_NEWLINE as b, RE_ONLY_WHITESPACE_WITH_AT_LEAST_ONE_NEWLINE as c, RE_STARTS_WITH_NEWLINE_OR_IS_EMPTY as d, RE_MATCH_NEWLINES as e, RE_DETECT_INDENTATION as f, RE_ANSI as g, RE_CONTROL as h, RE_EMOJI as i, RE_VALID_ANSI_PAIRS as j, RE_VALID_HYPERLINKS as k, RE_CYRILLIC as l, RE_LATIN as m, RE_GREEK as n, RE_GREEK_LATIN_SPLIT as o, RE_UZBEK_LATIN_MODIFIER as p, RE_KATAKANA as q, RE_KANJI as r, stripEmoji as s, RE_HIRAGANA as t, RE_HANGUL as u, RE_HEBREW as v, RE_ARABIC as w, RE_SEPARATORS as x, RE_DEVANAGARI as y, RE_BENGALI as z };
@@ -1,22 +0,0 @@
1
- const countOccurrences = (value, substring) => {
2
- const source = String(value);
3
- if (typeof substring !== "string") {
4
- throw new TypeError("Expected character");
5
- }
6
- if (substring.length === 0) {
7
- throw new TypeError("Expected non-empty substring");
8
- }
9
- let count = 0;
10
- let index = source.indexOf(substring);
11
- while (index !== -1) {
12
- count++;
13
- const nextIndex = index + substring.length;
14
- if (nextIndex <= index) {
15
- break;
16
- }
17
- index = source.indexOf(substring, nextIndex);
18
- }
19
- return count;
20
- };
21
-
22
- export { countOccurrences };
@@ -1,16 +0,0 @@
1
- const rtlRange = "֑-߿יִ-﷽ﹰ-ﻼ";
2
- const ltrRange = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿";
3
- const rtl = new RegExp(`^[^${ltrRange}]*[${rtlRange}]`);
4
- const ltr = new RegExp(`^[^${rtlRange}]*[${ltrRange}]`);
5
- const direction = (value = "") => {
6
- const source = value;
7
- if (rtl.test(source)) {
8
- return "rtl";
9
- }
10
- if (ltr.test(source)) {
11
- return "ltr";
12
- }
13
- return "neutral";
14
- };
15
-
16
- export { direction };
@@ -1,20 +0,0 @@
1
- import { i as isFullWidth, a as isWide, b as isAmbiguous, g as getCategory } from './lookup-BE8lEqy4.js';
2
-
3
- function validate(codePoint) {
4
- if (!Number.isSafeInteger(codePoint)) {
5
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
6
- }
7
- }
8
- function eastAsianWidthType(codePoint) {
9
- validate(codePoint);
10
- return getCategory(codePoint);
11
- }
12
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
13
- validate(codePoint);
14
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
15
- return 2;
16
- }
17
- return 1;
18
- }
19
-
20
- export { isFullWidth as _isFullWidth, isWide as _isWide, eastAsianWidth, eastAsianWidthType };