@visulima/string 1.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.
- package/CHANGELOG.md +5 -0
- package/LICENSE.md +77 -0
- package/README.md +880 -0
- package/dist/case/camel-case.cjs +59 -0
- package/dist/case/camel-case.d.cts +7 -0
- package/dist/case/camel-case.d.mts +7 -0
- package/dist/case/camel-case.d.ts +7 -0
- package/dist/case/camel-case.mjs +57 -0
- package/dist/case/capital-case.cjs +51 -0
- package/dist/case/capital-case.d.cts +7 -0
- package/dist/case/capital-case.d.mts +7 -0
- package/dist/case/capital-case.d.ts +7 -0
- package/dist/case/capital-case.mjs +49 -0
- package/dist/case/constant-case.cjs +11 -0
- package/dist/case/constant-case.d.cts +7 -0
- package/dist/case/constant-case.d.mts +7 -0
- package/dist/case/constant-case.d.ts +7 -0
- package/dist/case/constant-case.mjs +9 -0
- package/dist/case/dot-case.cjs +11 -0
- package/dist/case/dot-case.d.cts +7 -0
- package/dist/case/dot-case.d.mts +7 -0
- package/dist/case/dot-case.d.ts +7 -0
- package/dist/case/dot-case.mjs +9 -0
- package/dist/case/flat-case.cjs +11 -0
- package/dist/case/flat-case.d.cts +7 -0
- package/dist/case/flat-case.d.mts +7 -0
- package/dist/case/flat-case.d.ts +7 -0
- package/dist/case/flat-case.mjs +9 -0
- package/dist/case/flip-case.cjs +61 -0
- package/dist/case/flip-case.d.cts +8 -0
- package/dist/case/flip-case.d.mts +8 -0
- package/dist/case/flip-case.d.ts +8 -0
- package/dist/case/flip-case.mjs +57 -0
- package/dist/case/identify-case.cjs +30 -0
- package/dist/case/identify-case.d.cts +7 -0
- package/dist/case/identify-case.d.mts +7 -0
- package/dist/case/identify-case.d.ts +7 -0
- package/dist/case/identify-case.mjs +28 -0
- package/dist/case/index.cjs +47 -0
- package/dist/case/index.d.cts +26 -0
- package/dist/case/index.d.mts +26 -0
- package/dist/case/index.d.ts +26 -0
- package/dist/case/index.mjs +20 -0
- package/dist/case/kebab-case.cjs +61 -0
- package/dist/case/kebab-case.d.cts +11 -0
- package/dist/case/kebab-case.d.mts +11 -0
- package/dist/case/kebab-case.d.ts +11 -0
- package/dist/case/kebab-case.mjs +57 -0
- package/dist/case/lower-first.cjs +13 -0
- package/dist/case/lower-first.d.cts +7 -0
- package/dist/case/lower-first.d.mts +7 -0
- package/dist/case/lower-first.d.ts +7 -0
- package/dist/case/lower-first.mjs +11 -0
- package/dist/case/no-case.cjs +11 -0
- package/dist/case/no-case.d.cts +7 -0
- package/dist/case/no-case.d.mts +7 -0
- package/dist/case/no-case.d.ts +7 -0
- package/dist/case/no-case.mjs +9 -0
- package/dist/case/pascal-case.cjs +52 -0
- package/dist/case/pascal-case.d.cts +7 -0
- package/dist/case/pascal-case.d.mts +7 -0
- package/dist/case/pascal-case.d.ts +7 -0
- package/dist/case/pascal-case.mjs +50 -0
- package/dist/case/pascal-snake-case.cjs +32 -0
- package/dist/case/pascal-snake-case.d.cts +7 -0
- package/dist/case/pascal-snake-case.d.mts +7 -0
- package/dist/case/pascal-snake-case.d.ts +7 -0
- package/dist/case/pascal-snake-case.mjs +30 -0
- package/dist/case/path-case.cjs +11 -0
- package/dist/case/path-case.d.cts +7 -0
- package/dist/case/path-case.d.mts +7 -0
- package/dist/case/path-case.d.ts +7 -0
- package/dist/case/path-case.mjs +9 -0
- package/dist/case/sentence-case.cjs +58 -0
- package/dist/case/sentence-case.d.cts +7 -0
- package/dist/case/sentence-case.d.mts +7 -0
- package/dist/case/sentence-case.d.ts +7 -0
- package/dist/case/sentence-case.mjs +56 -0
- package/dist/case/snake-case.cjs +11 -0
- package/dist/case/snake-case.d.cts +7 -0
- package/dist/case/snake-case.d.mts +7 -0
- package/dist/case/snake-case.d.ts +7 -0
- package/dist/case/snake-case.mjs +9 -0
- package/dist/case/split-by-case.cjs +638 -0
- package/dist/case/split-by-case.d.cts +16 -0
- package/dist/case/split-by-case.d.mts +16 -0
- package/dist/case/split-by-case.d.ts +16 -0
- package/dist/case/split-by-case.mjs +634 -0
- package/dist/case/title-case.cjs +47 -0
- package/dist/case/title-case.d.cts +7 -0
- package/dist/case/title-case.d.mts +7 -0
- package/dist/case/title-case.d.ts +7 -0
- package/dist/case/title-case.mjs +45 -0
- package/dist/case/train-case.cjs +44 -0
- package/dist/case/train-case.d.cts +7 -0
- package/dist/case/train-case.d.mts +7 -0
- package/dist/case/train-case.d.ts +7 -0
- package/dist/case/train-case.mjs +42 -0
- package/dist/case/upper-first.cjs +13 -0
- package/dist/case/upper-first.d.cts +7 -0
- package/dist/case/upper-first.d.mts +7 -0
- package/dist/case/upper-first.d.ts +7 -0
- package/dist/case/upper-first.mjs +11 -0
- package/dist/get-string-truncated-width.cjs +386 -0
- package/dist/get-string-truncated-width.d.cts +25 -0
- package/dist/get-string-truncated-width.d.mts +25 -0
- package/dist/get-string-truncated-width.d.ts +25 -0
- package/dist/get-string-truncated-width.mjs +382 -0
- package/dist/get-string-width.cjs +11 -0
- package/dist/get-string-width.d.cts +6 -0
- package/dist/get-string-width.d.mts +6 -0
- package/dist/get-string-width.d.ts +6 -0
- package/dist/get-string-width.mjs +7 -0
- package/dist/index.cjs +60 -0
- package/dist/index.d.cts +43 -0
- package/dist/index.d.mts +43 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.mjs +26 -0
- package/dist/native-string-types.d.cts +128 -0
- package/dist/native-string-types.d.mts +128 -0
- package/dist/native-string-types.d.ts +128 -0
- package/dist/outdent.cjs +122 -0
- package/dist/outdent.d.cts +15 -0
- package/dist/outdent.d.mts +15 -0
- package/dist/outdent.d.ts +15 -0
- package/dist/outdent.mjs +118 -0
- package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +53 -0
- package/dist/packem_shared/LRUCache-udNErhWw.mjs +51 -0
- package/dist/packem_shared/WrapMode-BgOOthJV.mjs +545 -0
- package/dist/packem_shared/WrapMode-ZqTeXK8X.cjs +550 -0
- package/dist/packem_shared/constants-BnVGLrDr.mjs +99 -0
- package/dist/packem_shared/constants-HevSYUjU.cjs +149 -0
- package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +10 -0
- package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +8 -0
- package/dist/packem_shared/joinSegments-BH1CT4dK.cjs +48 -0
- package/dist/packem_shared/joinSegments-BHY8PPnk.mjs +46 -0
- package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +11 -0
- package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +9 -0
- package/dist/packem_shared/types-BAd3WDHo.d.mts +59 -0
- package/dist/packem_shared/types-BNbQJg02.d.cts +41 -0
- package/dist/packem_shared/types-BNbQJg02.d.mts +41 -0
- package/dist/packem_shared/types-BNbQJg02.d.ts +41 -0
- package/dist/packem_shared/types-BttWSSIk.d.ts +59 -0
- package/dist/packem_shared/types-D2-6p7t1.d.cts +59 -0
- package/dist/slice.cjs +413 -0
- package/dist/slice.d.cts +10 -0
- package/dist/slice.d.mts +10 -0
- package/dist/slice.d.ts +10 -0
- package/dist/slice.mjs +409 -0
- package/dist/test/utils.cjs +77 -0
- package/dist/test/utils.d.cts +30 -0
- package/dist/test/utils.d.mts +30 -0
- package/dist/test/utils.d.ts +30 -0
- package/dist/test/utils.mjs +71 -0
- package/dist/test/vitest.cjs +11 -0
- package/dist/test/vitest.d.cts +8 -0
- package/dist/test/vitest.d.mts +8 -0
- package/dist/test/vitest.d.ts +8 -0
- package/dist/test/vitest.mjs +7 -0
- package/dist/truncate.cjs +90 -0
- package/dist/truncate.d.cts +12 -0
- package/dist/truncate.d.mts +12 -0
- package/dist/truncate.d.ts +12 -0
- package/dist/truncate.mjs +86 -0
- package/dist/utils.cjs +9 -0
- package/dist/utils.d.cts +14 -0
- package/dist/utils.d.mts +14 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.mjs +1 -0
- package/package.json +468 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const node_util = require('node:util');
|
|
6
|
+
const constants = require('../packem_shared/constants-HevSYUjU.cjs');
|
|
7
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
8
|
+
|
|
9
|
+
var __defProp$2 = Object.defineProperty;
|
|
10
|
+
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
11
|
+
const regexCache = new LRUCache(1e3);
|
|
12
|
+
const getSeparatorsRegex = /* @__PURE__ */ __name$2((separators) => {
|
|
13
|
+
const key = separators.join("");
|
|
14
|
+
if (regexCache.has(key)) {
|
|
15
|
+
return regexCache.get(key);
|
|
16
|
+
}
|
|
17
|
+
const pattern = separators.map((s) => s.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
18
|
+
const regex = new RegExp(pattern, "g");
|
|
19
|
+
regexCache.set(key, regex);
|
|
20
|
+
return regex;
|
|
21
|
+
}, "getSeparatorsRegex");
|
|
22
|
+
|
|
23
|
+
var __defProp$1 = Object.defineProperty;
|
|
24
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
25
|
+
const splitByEmoji = /* @__PURE__ */ __name$1((text) => {
|
|
26
|
+
const segments = [];
|
|
27
|
+
let lastIndex = 0;
|
|
28
|
+
let match;
|
|
29
|
+
constants.RE_EMOJI.lastIndex = 0;
|
|
30
|
+
while ((match = constants.RE_EMOJI.exec(text)) !== null) {
|
|
31
|
+
if (match.index > lastIndex) {
|
|
32
|
+
segments.push(text.slice(lastIndex, match.index));
|
|
33
|
+
}
|
|
34
|
+
segments.push(match[0]);
|
|
35
|
+
lastIndex = constants.RE_EMOJI.lastIndex;
|
|
36
|
+
}
|
|
37
|
+
if (lastIndex < text.length) {
|
|
38
|
+
segments.push(text.slice(lastIndex));
|
|
39
|
+
}
|
|
40
|
+
return segments.filter(Boolean);
|
|
41
|
+
}, "splitByEmoji");
|
|
42
|
+
|
|
43
|
+
var __defProp = Object.defineProperty;
|
|
44
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
45
|
+
const isUpperCode = new Uint8Array(128);
|
|
46
|
+
const isLowerCode = new Uint8Array(128);
|
|
47
|
+
const isDigitCode = new Uint8Array(128);
|
|
48
|
+
for (let index = 0; index < 128; index++) {
|
|
49
|
+
isUpperCode[index] = index >= 65 && index <= 90 ? 1 : 0;
|
|
50
|
+
isLowerCode[index] = index >= 97 && index <= 122 ? 1 : 0;
|
|
51
|
+
isDigitCode[index] = index >= 48 && index <= 57 ? 1 : 0;
|
|
52
|
+
}
|
|
53
|
+
const handleScriptTransitions = /* @__PURE__ */ __name((s, scriptDetectors, caseSensitive, locale, customSplitLogic) => {
|
|
54
|
+
if (s.length === 0) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
let hasDetectedScript = false;
|
|
58
|
+
for (const detector of Object.values(scriptDetectors)) {
|
|
59
|
+
if (detector(s[0])) {
|
|
60
|
+
hasDetectedScript = true;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (!hasDetectedScript && !caseSensitive) {
|
|
65
|
+
return [s];
|
|
66
|
+
}
|
|
67
|
+
const chars = [...s];
|
|
68
|
+
const result = [];
|
|
69
|
+
let currentSegment = chars[0];
|
|
70
|
+
let previousType = "other";
|
|
71
|
+
for (const [type, detector] of Object.entries(scriptDetectors)) {
|
|
72
|
+
if (detector(chars[0])) {
|
|
73
|
+
previousType = type;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
let previousIsUpper = caseSensitive && locale ? chars[0] === chars[0].toLocaleUpperCase(locale) : false;
|
|
78
|
+
for (let index = 1; index < chars.length; index++) {
|
|
79
|
+
const char = chars[index];
|
|
80
|
+
let currentType = "other";
|
|
81
|
+
for (const [type, detector] of Object.entries(scriptDetectors)) {
|
|
82
|
+
if (detector(char)) {
|
|
83
|
+
currentType = type;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const isUpper = caseSensitive && locale ? char === char.toLocaleUpperCase(locale) : false;
|
|
88
|
+
let shouldSplit = false;
|
|
89
|
+
if (customSplitLogic) {
|
|
90
|
+
shouldSplit = customSplitLogic(previousType, currentType, previousIsUpper, isUpper, char, index, chars);
|
|
91
|
+
} else {
|
|
92
|
+
if (previousType !== currentType && previousType !== "other" && currentType !== "other") {
|
|
93
|
+
shouldSplit = true;
|
|
94
|
+
}
|
|
95
|
+
if (caseSensitive && currentType !== "other" && !previousIsUpper && isUpper) {
|
|
96
|
+
shouldSplit = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (shouldSplit) {
|
|
100
|
+
result.push(currentSegment);
|
|
101
|
+
currentSegment = char;
|
|
102
|
+
} else {
|
|
103
|
+
currentSegment += char;
|
|
104
|
+
}
|
|
105
|
+
previousType = currentType;
|
|
106
|
+
if (caseSensitive) {
|
|
107
|
+
previousIsUpper = isUpper;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (currentSegment && currentSegment.length > 0) {
|
|
111
|
+
result.push(currentSegment);
|
|
112
|
+
}
|
|
113
|
+
return result.length > 0 ? result : [s];
|
|
114
|
+
}, "handleScriptTransitions");
|
|
115
|
+
const splitCamelCaseFast = /* @__PURE__ */ __name((s, knownAcronyms = /* @__PURE__ */ new Set()) => {
|
|
116
|
+
if (s.length === 0) {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
if (s.toUpperCase() === s) {
|
|
120
|
+
return [s];
|
|
121
|
+
}
|
|
122
|
+
let start = 0;
|
|
123
|
+
const tokens = [];
|
|
124
|
+
const width = s.length;
|
|
125
|
+
for (let index = 1; index < width; index++) {
|
|
126
|
+
const previousCode = s.codePointAt(index - 1);
|
|
127
|
+
const currentCode = s.codePointAt(index);
|
|
128
|
+
if (knownAcronyms.size > 0) {
|
|
129
|
+
for (const acronym of knownAcronyms) {
|
|
130
|
+
if (s.startsWith(acronym, start)) {
|
|
131
|
+
tokens.push(acronym);
|
|
132
|
+
start += acronym.length;
|
|
133
|
+
index = start - 1;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (index < start) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const previousIsUpper = previousCode && previousCode < 128 && isUpperCode[previousCode];
|
|
142
|
+
const currentIsUpper = currentCode && currentCode < 128 && isUpperCode[currentCode];
|
|
143
|
+
const previousIsLower = previousCode && previousCode < 128 && isLowerCode[previousCode];
|
|
144
|
+
const previousIsDigit = previousCode && previousCode < 128 && isDigitCode[previousCode];
|
|
145
|
+
const currentIsDigit = currentCode && currentCode < 128 && isDigitCode[currentCode];
|
|
146
|
+
if (previousIsLower && currentIsUpper) {
|
|
147
|
+
tokens.push(s.slice(start, index));
|
|
148
|
+
start = index;
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (previousIsDigit && !currentIsDigit || !previousIsDigit && currentIsDigit) {
|
|
152
|
+
tokens.push(s.slice(start, index));
|
|
153
|
+
start = index;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (currentIsDigit && !previousIsDigit) {
|
|
157
|
+
let isNextUpper = false;
|
|
158
|
+
let isNextDigit = false;
|
|
159
|
+
if (index + 1 < width) {
|
|
160
|
+
const nextCode = s.codePointAt(index + 1);
|
|
161
|
+
isNextUpper = nextCode && nextCode < 128 && isUpperCode[nextCode];
|
|
162
|
+
isNextDigit = nextCode && nextCode < 128 && isDigitCode[nextCode];
|
|
163
|
+
}
|
|
164
|
+
if (!isNextDigit && isNextUpper) {
|
|
165
|
+
tokens.push(s.slice(start, index), s.slice(index, index + 1));
|
|
166
|
+
start = index + 1;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (index + 1 < width) {
|
|
171
|
+
const nextCode = s.codePointAt(index + 1);
|
|
172
|
+
const nextIsLower = nextCode && nextCode < 128 && isLowerCode[nextCode];
|
|
173
|
+
if (previousIsUpper && currentIsUpper && nextIsLower) {
|
|
174
|
+
const candidate = s.slice(start, index + 1);
|
|
175
|
+
if (!knownAcronyms.has(candidate)) {
|
|
176
|
+
tokens.push(s.slice(start, index));
|
|
177
|
+
start = index;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (start < width) {
|
|
183
|
+
tokens.push(s.slice(start));
|
|
184
|
+
}
|
|
185
|
+
return tokens.filter((token) => token !== "");
|
|
186
|
+
}, "splitCamelCaseFast");
|
|
187
|
+
const splitCamelCaseLocale = /* @__PURE__ */ __name((s, locale, knownAcronyms) => {
|
|
188
|
+
if (s.length === 0) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const isUpperCase = s === s.toLocaleUpperCase(locale);
|
|
192
|
+
if (locale.startsWith("de")) {
|
|
193
|
+
if (!isUpperCase && s.replaceAll("ß", "SS") === s.toLocaleUpperCase(locale)) {
|
|
194
|
+
return [s];
|
|
195
|
+
}
|
|
196
|
+
const chars2 = [...s];
|
|
197
|
+
const width_2 = chars2.length;
|
|
198
|
+
const result2 = [];
|
|
199
|
+
let currentSegment2 = chars2[0];
|
|
200
|
+
let previousIsUpper2 = chars2[0] === chars2[0].toLocaleUpperCase(locale);
|
|
201
|
+
let isInUpperSequence = previousIsUpper2;
|
|
202
|
+
let upperSequenceStart = previousIsUpper2 ? 0 : -1;
|
|
203
|
+
for (let index = 1; index < width_2; index++) {
|
|
204
|
+
const char = chars2[index];
|
|
205
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
206
|
+
if (isUpper === previousIsUpper2) {
|
|
207
|
+
currentSegment2 += char;
|
|
208
|
+
} else if (isUpper) {
|
|
209
|
+
if (currentSegment2 && currentSegment2.length > 0) {
|
|
210
|
+
result2.push(currentSegment2);
|
|
211
|
+
currentSegment2 = char;
|
|
212
|
+
}
|
|
213
|
+
isInUpperSequence = true;
|
|
214
|
+
upperSequenceStart = index;
|
|
215
|
+
} else {
|
|
216
|
+
if (isInUpperSequence && index - upperSequenceStart > 1) {
|
|
217
|
+
const lastUpperChar = chars2[index - 1];
|
|
218
|
+
const withoutLastUpper = currentSegment2.slice(0, -1);
|
|
219
|
+
if (withoutLastUpper && withoutLastUpper.length > 0) {
|
|
220
|
+
result2.push(withoutLastUpper);
|
|
221
|
+
}
|
|
222
|
+
currentSegment2 = lastUpperChar + char;
|
|
223
|
+
} else {
|
|
224
|
+
currentSegment2 += char;
|
|
225
|
+
}
|
|
226
|
+
isInUpperSequence = false;
|
|
227
|
+
upperSequenceStart = -1;
|
|
228
|
+
}
|
|
229
|
+
previousIsUpper2 = isUpper;
|
|
230
|
+
}
|
|
231
|
+
if (currentSegment2 && currentSegment2.length > 0) {
|
|
232
|
+
result2.push(currentSegment2);
|
|
233
|
+
}
|
|
234
|
+
return result2;
|
|
235
|
+
}
|
|
236
|
+
if (locale.startsWith("uk") || locale.startsWith("ru") || locale.startsWith("bg") || locale.startsWith("sr") || locale.startsWith("mk") || locale.startsWith("be")) {
|
|
237
|
+
if (!constants.RE_CYRILLIC.test(s) && !constants.RE_LATIN.test(s)) {
|
|
238
|
+
return [s];
|
|
239
|
+
}
|
|
240
|
+
const chars2 = [...s];
|
|
241
|
+
const width_2 = chars2.length;
|
|
242
|
+
const result2 = [];
|
|
243
|
+
let currentSegment2 = chars2[0];
|
|
244
|
+
let previousType = constants.RE_CYRILLIC.test(chars2[0]) ? 1 : constants.RE_LATIN.test(chars2[0]) ? 2 : 0;
|
|
245
|
+
let previousIsUpper2 = chars2[0] === chars2[0].toLocaleUpperCase(locale);
|
|
246
|
+
for (let index = 1; index < width_2; index++) {
|
|
247
|
+
const char = chars2[index];
|
|
248
|
+
const currentType = constants.RE_CYRILLIC.test(char) ? 1 : constants.RE_LATIN.test(char) ? 2 : 0;
|
|
249
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
250
|
+
if (previousType !== currentType && (previousType === 1 || previousType === 2) && (currentType === 1 || currentType === 2) || currentType === previousType && !previousIsUpper2 && isUpper) {
|
|
251
|
+
result2.push(currentSegment2);
|
|
252
|
+
currentSegment2 = char;
|
|
253
|
+
} else {
|
|
254
|
+
currentSegment2 += char;
|
|
255
|
+
}
|
|
256
|
+
previousType = currentType;
|
|
257
|
+
previousIsUpper2 = isUpper;
|
|
258
|
+
}
|
|
259
|
+
if (currentSegment2 && currentSegment2.length > 0) {
|
|
260
|
+
result2.push(currentSegment2);
|
|
261
|
+
}
|
|
262
|
+
const finalResult = [];
|
|
263
|
+
for (let index = 0; index < result2.length; index++) {
|
|
264
|
+
if (index < result2.length - 1 && // eslint-disable-next-line security/detect-object-injection
|
|
265
|
+
result2[index].length === 1 && // eslint-disable-next-line security/detect-object-injection
|
|
266
|
+
constants.RE_LATIN.test(result2[index]) && constants.RE_CYRILLIC.test(result2[index + 1][0])) {
|
|
267
|
+
finalResult.push(result2[index] + result2[index + 1]);
|
|
268
|
+
index++;
|
|
269
|
+
} else {
|
|
270
|
+
finalResult.push(result2[index]);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return finalResult;
|
|
274
|
+
}
|
|
275
|
+
if (locale.startsWith("el")) {
|
|
276
|
+
if (!constants.RE_GREEK.test(s) && !constants.RE_LATIN.test(s)) {
|
|
277
|
+
return [s];
|
|
278
|
+
}
|
|
279
|
+
const parts = s.match(constants.RE_GREEK_LATIN_SPLIT) ?? [s];
|
|
280
|
+
const result2 = [];
|
|
281
|
+
const width = parts.length;
|
|
282
|
+
if (width === 1) {
|
|
283
|
+
const part = parts[0];
|
|
284
|
+
if (!part || !constants.RE_GREEK.test(part[0]) || part.length === 1) {
|
|
285
|
+
return [part || s];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
for (const part of parts) {
|
|
289
|
+
if (!part) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (!constants.RE_GREEK.test(part[0]) || part.length === 1) {
|
|
293
|
+
result2.push(part);
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
const partLength = part.length;
|
|
297
|
+
let word = part[0];
|
|
298
|
+
let previousIsUpper2 = part[0] === part[0].toLocaleUpperCase(locale);
|
|
299
|
+
for (let index = 1; index < partLength; index++) {
|
|
300
|
+
const char = part[index];
|
|
301
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
302
|
+
if (!previousIsUpper2 && isUpper) {
|
|
303
|
+
result2.push(word);
|
|
304
|
+
word = char;
|
|
305
|
+
} else {
|
|
306
|
+
word += char;
|
|
307
|
+
}
|
|
308
|
+
previousIsUpper2 = isUpper;
|
|
309
|
+
}
|
|
310
|
+
if (word) {
|
|
311
|
+
result2.push(word);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return result2;
|
|
315
|
+
}
|
|
316
|
+
if (locale.startsWith("ja") || locale.startsWith("ko")) {
|
|
317
|
+
const isJapanese = locale.startsWith("ja");
|
|
318
|
+
const scriptDetectors = isJapanese ? {
|
|
319
|
+
hiragana: /* @__PURE__ */ __name((char) => constants.RE_HIRAGANA.test(char), "hiragana"),
|
|
320
|
+
kanji: /* @__PURE__ */ __name((char) => constants.RE_KANJI.test(char), "kanji"),
|
|
321
|
+
katakana: /* @__PURE__ */ __name((char) => constants.RE_KATAKANA.test(char), "katakana"),
|
|
322
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
323
|
+
} : {
|
|
324
|
+
hangul: /* @__PURE__ */ __name((char) => constants.RE_HANGUL.test(char), "hangul"),
|
|
325
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
326
|
+
};
|
|
327
|
+
const particles = /* @__PURE__ */ new Set(["と", "に", "へ", "を", "は", "が", "の", "で", "や", "も"]);
|
|
328
|
+
if (isJapanese) {
|
|
329
|
+
const baseSegments = handleScriptTransitions(
|
|
330
|
+
s,
|
|
331
|
+
scriptDetectors,
|
|
332
|
+
false,
|
|
333
|
+
locale,
|
|
334
|
+
(previousType, currentType) => previousType === "hiragana" && currentType === "katakana" || // hiragana -> katakana
|
|
335
|
+
previousType === "katakana" && currentType === "hiragana" || // katakana -> hiragana
|
|
336
|
+
previousType === "hiragana" && currentType === "latin" || // hiragana -> latin
|
|
337
|
+
previousType === "katakana" && currentType === "latin" || // katakana -> latin
|
|
338
|
+
previousType === "kanji" && currentType === "latin" || // kanji -> latin
|
|
339
|
+
previousType === "latin" && (currentType === "hiragana" || currentType === "katakana" || currentType === "kanji")
|
|
340
|
+
// latin -> japanese
|
|
341
|
+
);
|
|
342
|
+
const result2 = [];
|
|
343
|
+
for (const segment of baseSegments) {
|
|
344
|
+
if (segment.length === 1 && particles.has(segment) && result2.length > 0) {
|
|
345
|
+
result2[result2.length - 1] += segment;
|
|
346
|
+
} else {
|
|
347
|
+
result2.push(segment);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return result2.length > 0 ? result2 : [s];
|
|
351
|
+
}
|
|
352
|
+
return handleScriptTransitions(
|
|
353
|
+
s,
|
|
354
|
+
scriptDetectors,
|
|
355
|
+
false,
|
|
356
|
+
locale,
|
|
357
|
+
(previousType, currentType) => previousType === "hangul" && currentType === "latin" || // hangul -> latin
|
|
358
|
+
previousType === "latin" && currentType === "hangul"
|
|
359
|
+
// latin -> hangul
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
if (locale.startsWith("sl")) {
|
|
363
|
+
const chars2 = [...s];
|
|
364
|
+
const width_2 = chars2.length;
|
|
365
|
+
const result2 = [];
|
|
366
|
+
let currentSegment2 = chars2[0];
|
|
367
|
+
let previousIsUpper2 = chars2[0] === chars2[0].toLocaleUpperCase(locale);
|
|
368
|
+
for (let index = 1; index < width_2; index++) {
|
|
369
|
+
const char = chars2[index];
|
|
370
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
371
|
+
const isSpecialChar = /[ČŠŽĐ]/i.test(char);
|
|
372
|
+
const nextIsUpper = index < width_2 - 1 && chars2[index + 1] === chars2[index + 1].toLocaleUpperCase(locale);
|
|
373
|
+
if (!previousIsUpper2 && isUpper || isSpecialChar && nextIsUpper) {
|
|
374
|
+
result2.push(currentSegment2);
|
|
375
|
+
currentSegment2 = char;
|
|
376
|
+
if (isSpecialChar && nextIsUpper) {
|
|
377
|
+
result2.push(currentSegment2);
|
|
378
|
+
currentSegment2 = "";
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
currentSegment2 += char;
|
|
382
|
+
}
|
|
383
|
+
previousIsUpper2 = isUpper;
|
|
384
|
+
}
|
|
385
|
+
if (currentSegment2 && currentSegment2.length > 0) {
|
|
386
|
+
result2.push(currentSegment2);
|
|
387
|
+
}
|
|
388
|
+
return result2;
|
|
389
|
+
}
|
|
390
|
+
if (locale.startsWith("zh")) {
|
|
391
|
+
return handleScriptTransitions(
|
|
392
|
+
s,
|
|
393
|
+
{
|
|
394
|
+
han: /* @__PURE__ */ __name((char) => constants.RE_KANJI.test(char), "han"),
|
|
395
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
396
|
+
},
|
|
397
|
+
false,
|
|
398
|
+
locale
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
if (["ar", "fa", "he", "ur"].includes(locale.split("-")[0])) {
|
|
402
|
+
const isRtlChar = /* @__PURE__ */ __name((ch) => constants.RE_HEBREW.test(ch) || constants.RE_ARABIC.test(ch), "isRtlChar");
|
|
403
|
+
return handleScriptTransitions(
|
|
404
|
+
s,
|
|
405
|
+
{
|
|
406
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin"),
|
|
407
|
+
rtl: /* @__PURE__ */ __name((char) => isRtlChar(char), "rtl")
|
|
408
|
+
},
|
|
409
|
+
false,
|
|
410
|
+
locale
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
if ([
|
|
414
|
+
"am",
|
|
415
|
+
// Amharic
|
|
416
|
+
"bn",
|
|
417
|
+
// Bengali
|
|
418
|
+
"gu",
|
|
419
|
+
// Gujarati
|
|
420
|
+
"hi",
|
|
421
|
+
// Hindi
|
|
422
|
+
"km",
|
|
423
|
+
// Khmer
|
|
424
|
+
"kn",
|
|
425
|
+
// Kannada
|
|
426
|
+
"lo",
|
|
427
|
+
// Lao
|
|
428
|
+
"ml",
|
|
429
|
+
// Malayalam
|
|
430
|
+
"mr",
|
|
431
|
+
// Marathi
|
|
432
|
+
"ne",
|
|
433
|
+
// Nepali
|
|
434
|
+
"or",
|
|
435
|
+
// Oriya
|
|
436
|
+
"pa",
|
|
437
|
+
// Punjabi
|
|
438
|
+
"si",
|
|
439
|
+
// Sinhala
|
|
440
|
+
"ta",
|
|
441
|
+
// Tamil
|
|
442
|
+
"te",
|
|
443
|
+
// Telugu
|
|
444
|
+
"th"
|
|
445
|
+
// Thai
|
|
446
|
+
].includes(locale.split("-")[0])) {
|
|
447
|
+
const isIndicChar = /* @__PURE__ */ __name((ch) => constants.RE_DEVANAGARI.test(ch) || constants.RE_BENGALI.test(ch) || constants.RE_GUJARATI.test(ch) || constants.RE_GURMUKHI.test(ch) || constants.RE_KANNADA.test(ch) || constants.RE_TAMIL.test(ch) || constants.RE_TELUGU.test(ch) || constants.RE_MALAYALAM.test(ch) || constants.RE_SINHALA.test(ch) || constants.RE_THAI.test(ch) || constants.RE_LAO.test(ch) || constants.RE_TIBETAN.test(ch) || constants.RE_MYANMAR.test(ch) || constants.RE_ETHIOPIC.test(ch) || constants.RE_KHMER.test(ch) || constants.RE_ORIYA.test(ch), "isIndicChar");
|
|
448
|
+
return handleScriptTransitions(
|
|
449
|
+
s,
|
|
450
|
+
{
|
|
451
|
+
indic: /* @__PURE__ */ __name((char) => isIndicChar(char), "indic"),
|
|
452
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
453
|
+
},
|
|
454
|
+
false,
|
|
455
|
+
locale
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
if (["be", "bg", "ru", "sr", "uk"].includes(locale)) {
|
|
459
|
+
return handleScriptTransitions(
|
|
460
|
+
s,
|
|
461
|
+
{
|
|
462
|
+
cyrillic: /* @__PURE__ */ __name((char) => constants.RE_CYRILLIC.test(char), "cyrillic"),
|
|
463
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
464
|
+
},
|
|
465
|
+
true,
|
|
466
|
+
// Enable case-sensitive splitting
|
|
467
|
+
locale
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
if (["ar", "fa", "he"].includes(locale)) {
|
|
471
|
+
return handleScriptTransitions(
|
|
472
|
+
s,
|
|
473
|
+
{
|
|
474
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin"),
|
|
475
|
+
rtl: /* @__PURE__ */ __name((char) => constants.RE_HEBREW.test(char) || constants.RE_ARABIC.test(char), "rtl")
|
|
476
|
+
},
|
|
477
|
+
false,
|
|
478
|
+
locale
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
if (locale.startsWith("ko")) {
|
|
482
|
+
return handleScriptTransitions(
|
|
483
|
+
s,
|
|
484
|
+
{
|
|
485
|
+
hangul: /* @__PURE__ */ __name((char) => constants.RE_HANGUL.test(char), "hangul"),
|
|
486
|
+
latin: /* @__PURE__ */ __name((char) => constants.RE_LATIN.test(char), "latin")
|
|
487
|
+
},
|
|
488
|
+
false,
|
|
489
|
+
locale
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
if (locale.startsWith("uz")) {
|
|
493
|
+
if (!constants.RE_CYRILLIC.test(s) && !constants.RE_LATIN.test(s)) {
|
|
494
|
+
return [s];
|
|
495
|
+
}
|
|
496
|
+
const chars2 = [...s];
|
|
497
|
+
const width_2 = chars2.length;
|
|
498
|
+
const result2 = [];
|
|
499
|
+
let currentSegment2 = chars2[0];
|
|
500
|
+
let previousIsUpper2 = chars2[0] === chars2[0].toLocaleUpperCase(locale);
|
|
501
|
+
for (let index = 1; index < width_2; index++) {
|
|
502
|
+
const char = chars2[index];
|
|
503
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
504
|
+
if (constants.RE_UZBEK_LATIN_MODIFIER.test(char) || constants.RE_UZBEK_LATIN_MODIFIER.test(chars2[index - 1])) {
|
|
505
|
+
currentSegment2 += char;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (!previousIsUpper2 && isUpper) {
|
|
509
|
+
result2.push(currentSegment2);
|
|
510
|
+
currentSegment2 = char;
|
|
511
|
+
} else {
|
|
512
|
+
currentSegment2 += char;
|
|
513
|
+
}
|
|
514
|
+
previousIsUpper2 = isUpper;
|
|
515
|
+
}
|
|
516
|
+
if (currentSegment2 && currentSegment2.length > 0) {
|
|
517
|
+
result2.push(currentSegment2);
|
|
518
|
+
}
|
|
519
|
+
return result2;
|
|
520
|
+
}
|
|
521
|
+
const chars = [...s];
|
|
522
|
+
const width_ = chars.length;
|
|
523
|
+
const result = [];
|
|
524
|
+
let currentSegment = chars[0];
|
|
525
|
+
let previousIsUpper = chars[0] === chars[0].toLocaleUpperCase(locale);
|
|
526
|
+
for (const acronym of knownAcronyms) {
|
|
527
|
+
if (s.startsWith(acronym)) {
|
|
528
|
+
result.push(acronym);
|
|
529
|
+
currentSegment = chars[acronym.length];
|
|
530
|
+
previousIsUpper = currentSegment === currentSegment.toLocaleUpperCase(locale);
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
for (let index = 1; index < width_; index++) {
|
|
535
|
+
const char = chars[index];
|
|
536
|
+
const isUpper = char === char.toLocaleUpperCase(locale);
|
|
537
|
+
let isAcronym = false;
|
|
538
|
+
for (const acronym of knownAcronyms) {
|
|
539
|
+
if (s.startsWith(acronym, index)) {
|
|
540
|
+
result.push(currentSegment, acronym);
|
|
541
|
+
index += acronym.length - 1;
|
|
542
|
+
currentSegment = "";
|
|
543
|
+
isAcronym = true;
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (isAcronym) {
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
if (!previousIsUpper && isUpper) {
|
|
551
|
+
result.push(currentSegment);
|
|
552
|
+
currentSegment = char;
|
|
553
|
+
} else {
|
|
554
|
+
currentSegment += char;
|
|
555
|
+
}
|
|
556
|
+
previousIsUpper = isUpper;
|
|
557
|
+
}
|
|
558
|
+
if (currentSegment) {
|
|
559
|
+
result.push(currentSegment);
|
|
560
|
+
}
|
|
561
|
+
return result;
|
|
562
|
+
}, "splitCamelCaseLocale");
|
|
563
|
+
const processTextWithAnsiEmoji = /* @__PURE__ */ __name((text, locale, knownAcronyms) => {
|
|
564
|
+
const result = [];
|
|
565
|
+
const segments = constants.RE_FAST_ANSI.test(text) ? text.split(constants.RE_FAST_ANSI).filter(Boolean) : [text];
|
|
566
|
+
for (const seg of segments) {
|
|
567
|
+
if (constants.RE_FAST_ANSI.test(seg)) {
|
|
568
|
+
result.push(seg);
|
|
569
|
+
} else {
|
|
570
|
+
const subs = constants.RE_EMOJI.test(seg) ? splitByEmoji(seg).filter(Boolean) : [seg];
|
|
571
|
+
for (const sub of subs) {
|
|
572
|
+
if (constants.RE_EMOJI.test(sub)) {
|
|
573
|
+
result.push(sub);
|
|
574
|
+
} else {
|
|
575
|
+
if (locale) {
|
|
576
|
+
const normalizedLocale = locale.toLowerCase().split("-")[0];
|
|
577
|
+
result.push(...splitCamelCaseLocale(sub, normalizedLocale, knownAcronyms));
|
|
578
|
+
} else {
|
|
579
|
+
result.push(...splitCamelCaseFast(sub, knownAcronyms));
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return result;
|
|
586
|
+
}, "processTextWithAnsiEmoji");
|
|
587
|
+
const splitByCase = /* @__PURE__ */ __name((input, options = {}) => {
|
|
588
|
+
if (!input || typeof input !== "string") {
|
|
589
|
+
return [];
|
|
590
|
+
}
|
|
591
|
+
const {
|
|
592
|
+
handleAnsi = false,
|
|
593
|
+
handleEmoji = false,
|
|
594
|
+
knownAcronyms = [],
|
|
595
|
+
locale,
|
|
596
|
+
normalize = false,
|
|
597
|
+
separators,
|
|
598
|
+
stripAnsi: stripAnsiOption = false,
|
|
599
|
+
stripEmoji: stripEmojiOption = false
|
|
600
|
+
} = options;
|
|
601
|
+
const acronymSet = new Set([...knownAcronyms].sort((a, b) => b.length - a.length));
|
|
602
|
+
let cleanedInput = input;
|
|
603
|
+
if (stripAnsiOption) {
|
|
604
|
+
cleanedInput = node_util.stripVTControlCharacters(cleanedInput);
|
|
605
|
+
}
|
|
606
|
+
if (stripEmojiOption) {
|
|
607
|
+
cleanedInput = constants.stripEmoji(cleanedInput);
|
|
608
|
+
}
|
|
609
|
+
const separatorRegex = Array.isArray(separators) ? getSeparatorsRegex(separators) : separators instanceof RegExp ? separators : constants.RE_SEPARATORS;
|
|
610
|
+
const parts = cleanedInput.split(separatorRegex).filter(Boolean);
|
|
611
|
+
let tokens = [];
|
|
612
|
+
for (const part of parts) {
|
|
613
|
+
if (handleAnsi || handleEmoji) {
|
|
614
|
+
tokens.push(...processTextWithAnsiEmoji(part, locale, acronymSet));
|
|
615
|
+
} else if (locale) {
|
|
616
|
+
tokens.push(...splitCamelCaseLocale(part, locale, acronymSet));
|
|
617
|
+
} else {
|
|
618
|
+
tokens.push(...splitCamelCaseFast(part, acronymSet));
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (normalize) {
|
|
622
|
+
tokens = tokens.map((token) => {
|
|
623
|
+
if (acronymSet.has(token)) {
|
|
624
|
+
return token;
|
|
625
|
+
}
|
|
626
|
+
if (locale && token === token.toLocaleUpperCase(locale)) {
|
|
627
|
+
return token[0] + token.slice(1).toLocaleLowerCase(locale);
|
|
628
|
+
}
|
|
629
|
+
if (token.toUpperCase() === token && !acronymSet.has(token)) {
|
|
630
|
+
return token.slice(0, 1) + token.slice(1).toLowerCase();
|
|
631
|
+
}
|
|
632
|
+
return token;
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
return tokens;
|
|
636
|
+
}, "splitByCase");
|
|
637
|
+
|
|
638
|
+
exports.splitByCase = splitByCase;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { L as LocaleOptions, i as SplitByCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
interface SplitOptions extends LocaleOptions {
|
|
6
|
+
handleAnsi?: boolean;
|
|
7
|
+
handleEmoji?: boolean;
|
|
8
|
+
knownAcronyms?: ReadonlyArray<string>;
|
|
9
|
+
normalize?: boolean;
|
|
10
|
+
separators?: ReadonlyArray<string> | RegExp;
|
|
11
|
+
stripAnsi?: boolean;
|
|
12
|
+
stripEmoji?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const splitByCase: <T extends string = string>(input: T, options?: SplitOptions) => SplitByCase<T>;
|
|
15
|
+
|
|
16
|
+
export { type SplitOptions, splitByCase };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { L as LocaleOptions, i as SplitByCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
interface SplitOptions extends LocaleOptions {
|
|
6
|
+
handleAnsi?: boolean;
|
|
7
|
+
handleEmoji?: boolean;
|
|
8
|
+
knownAcronyms?: ReadonlyArray<string>;
|
|
9
|
+
normalize?: boolean;
|
|
10
|
+
separators?: ReadonlyArray<string> | RegExp;
|
|
11
|
+
stripAnsi?: boolean;
|
|
12
|
+
stripEmoji?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const splitByCase: <T extends string = string>(input: T, options?: SplitOptions) => SplitByCase<T>;
|
|
15
|
+
|
|
16
|
+
export { type SplitOptions, splitByCase };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { L as LocaleOptions, i as SplitByCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface SplitOptions extends LocaleOptions {
|
|
6
|
+
handleAnsi?: boolean;
|
|
7
|
+
handleEmoji?: boolean;
|
|
8
|
+
knownAcronyms?: ReadonlyArray<string>;
|
|
9
|
+
normalize?: boolean;
|
|
10
|
+
separators?: ReadonlyArray<string> | RegExp;
|
|
11
|
+
stripAnsi?: boolean;
|
|
12
|
+
stripEmoji?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const splitByCase: <T extends string = string>(input: T, options?: SplitOptions) => SplitByCase<T>;
|
|
15
|
+
|
|
16
|
+
export { type SplitOptions, splitByCase };
|