@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,25 @@
|
|
|
1
|
+
interface StringTruncatedWidthOptions {
|
|
2
|
+
ambiguousIsNarrow?: boolean;
|
|
3
|
+
ambiguousWidth?: number;
|
|
4
|
+
ansiWidth?: number;
|
|
5
|
+
controlWidth?: number;
|
|
6
|
+
countAnsiEscapeCodes?: boolean;
|
|
7
|
+
ellipsis?: string;
|
|
8
|
+
ellipsisWidth?: number;
|
|
9
|
+
emojiWidth?: number;
|
|
10
|
+
fullWidth?: number;
|
|
11
|
+
halfWidth?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
regularWidth?: number;
|
|
14
|
+
tabWidth?: number;
|
|
15
|
+
wideWidth?: number;
|
|
16
|
+
}
|
|
17
|
+
interface StringTruncatedWidthResult {
|
|
18
|
+
ellipsed: boolean;
|
|
19
|
+
index: number;
|
|
20
|
+
truncated: boolean;
|
|
21
|
+
width: number;
|
|
22
|
+
}
|
|
23
|
+
declare const getStringTruncatedWidth: (input: string, options?: StringTruncatedWidthOptions) => StringTruncatedWidthResult;
|
|
24
|
+
|
|
25
|
+
export { type StringTruncatedWidthOptions, type StringTruncatedWidthResult, getStringTruncatedWidth };
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { a as RE_ANSI, L as RE_ANSI_LINK_END, M as RE_CONTROL, h as RE_EMOJI } from './packem_shared/constants-BnVGLrDr.mjs';
|
|
2
|
+
|
|
3
|
+
var __defProp$2 = Object.defineProperty;
|
|
4
|
+
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
5
|
+
function isAmbiguous(x) {
|
|
6
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
7
|
+
}
|
|
8
|
+
__name$2(isAmbiguous, "isAmbiguous");
|
|
9
|
+
function isFullWidth(x) {
|
|
10
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
11
|
+
}
|
|
12
|
+
__name$2(isFullWidth, "isFullWidth");
|
|
13
|
+
function isWide(x) {
|
|
14
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
15
|
+
}
|
|
16
|
+
__name$2(isWide, "isWide");
|
|
17
|
+
function getCategory(x) {
|
|
18
|
+
if (isAmbiguous(x)) return "ambiguous";
|
|
19
|
+
if (isFullWidth(x)) return "fullwidth";
|
|
20
|
+
if (x === 8361 || x >= 65377 && x <= 65470 || x >= 65474 && x <= 65479 || x >= 65482 && x <= 65487 || x >= 65490 && x <= 65495 || x >= 65498 && x <= 65500 || x >= 65512 && x <= 65518) {
|
|
21
|
+
return "halfwidth";
|
|
22
|
+
}
|
|
23
|
+
if (x >= 32 && x <= 126 || x === 162 || x === 163 || x === 165 || x === 166 || x === 172 || x === 175 || x >= 10214 && x <= 10221 || x === 10629 || x === 10630) {
|
|
24
|
+
return "narrow";
|
|
25
|
+
}
|
|
26
|
+
if (isWide(x)) return "wide";
|
|
27
|
+
return "neutral";
|
|
28
|
+
}
|
|
29
|
+
__name$2(getCategory, "getCategory");
|
|
30
|
+
|
|
31
|
+
var __defProp$1 = Object.defineProperty;
|
|
32
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
33
|
+
function validate(codePoint) {
|
|
34
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
35
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__name$1(validate, "validate");
|
|
39
|
+
function eastAsianWidthType(codePoint) {
|
|
40
|
+
validate(codePoint);
|
|
41
|
+
return getCategory(codePoint);
|
|
42
|
+
}
|
|
43
|
+
__name$1(eastAsianWidthType, "eastAsianWidthType");
|
|
44
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
45
|
+
validate(codePoint);
|
|
46
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
47
|
+
return 2;
|
|
48
|
+
}
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
__name$1(eastAsianWidth, "eastAsianWidth");
|
|
52
|
+
|
|
53
|
+
var __defProp = Object.defineProperty;
|
|
54
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
55
|
+
const charWidthCache = /* @__PURE__ */ new Map();
|
|
56
|
+
const RE_LATIN_CHARS = /(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y;
|
|
57
|
+
const getCharType = /* @__PURE__ */ __name((codePoint) => {
|
|
58
|
+
if (codePoint >= 32 && codePoint <= 126) {
|
|
59
|
+
return "latin";
|
|
60
|
+
}
|
|
61
|
+
if (codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8288) {
|
|
62
|
+
return "zero";
|
|
63
|
+
}
|
|
64
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
65
|
+
return "control";
|
|
66
|
+
}
|
|
67
|
+
if (codePoint >= 160 && codePoint <= 255) {
|
|
68
|
+
return "latin";
|
|
69
|
+
}
|
|
70
|
+
if (codePoint >= 4352 && codePoint <= 4607 || // Hangul Jamo
|
|
71
|
+
codePoint >= 11904 && codePoint <= 40959 || // CJK & radicals
|
|
72
|
+
codePoint >= 44032 && codePoint <= 55215 || // Hangul Syllables
|
|
73
|
+
codePoint >= 63744 && codePoint <= 64255 || // CJK Compatibility Ideographs
|
|
74
|
+
codePoint >= 65280 && codePoint <= 65519 && !(codePoint >= 65377 && codePoint <= 65439) || // Full-width Forms (excluding half-width katakana)
|
|
75
|
+
codePoint >= 12352 && codePoint <= 12543) {
|
|
76
|
+
return "wide";
|
|
77
|
+
}
|
|
78
|
+
return "other";
|
|
79
|
+
}, "getCharType");
|
|
80
|
+
const getCachedCharWidth = /* @__PURE__ */ __name((codePoint, config) => {
|
|
81
|
+
const highBits = Math.floor(codePoint / 65536);
|
|
82
|
+
const lowBits = codePoint % 65536;
|
|
83
|
+
let lowMap = charWidthCache.get(highBits);
|
|
84
|
+
if (!lowMap) {
|
|
85
|
+
lowMap = /* @__PURE__ */ new Map();
|
|
86
|
+
charWidthCache.set(highBits, lowMap);
|
|
87
|
+
}
|
|
88
|
+
if (lowMap.has(lowBits)) {
|
|
89
|
+
return lowMap.get(lowBits);
|
|
90
|
+
}
|
|
91
|
+
let width;
|
|
92
|
+
if (getCharType(codePoint) === "latin") {
|
|
93
|
+
width = config.width.regular;
|
|
94
|
+
} else if (getCharType(codePoint) === "control") {
|
|
95
|
+
width = config.width.control;
|
|
96
|
+
} else if (getCharType(codePoint) === "wide") {
|
|
97
|
+
width = config.width.wide;
|
|
98
|
+
} else {
|
|
99
|
+
const eaw = eastAsianWidthType(codePoint);
|
|
100
|
+
switch (eaw) {
|
|
101
|
+
case "fullwidth": {
|
|
102
|
+
width = config.width.fullWidth;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case "wide": {
|
|
106
|
+
width = config.width.wide;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case "ambiguous": {
|
|
110
|
+
width = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
default: {
|
|
114
|
+
width = config.width.regular;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
lowMap.set(lowBits, width);
|
|
119
|
+
return width;
|
|
120
|
+
}, "getCachedCharWidth");
|
|
121
|
+
const isCombiningCharacter = /* @__PURE__ */ __name((codePoint) => {
|
|
122
|
+
if (codePoint >= 768 && codePoint <= 879 || // Combining Diacritical Marks
|
|
123
|
+
codePoint >= 6832 && codePoint <= 6911 || // Combining Diacritical Marks Extended
|
|
124
|
+
codePoint >= 7616 && codePoint <= 7679 || // Combining Diacritical Marks Supplement
|
|
125
|
+
codePoint >= 8400 && codePoint <= 8447 || // Combining Diacritical Marks for Symbols
|
|
126
|
+
codePoint >= 65056 && codePoint <= 65071) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
if (codePoint >= 917760 && codePoint <= 917999 || // Variation Selectors Supplement
|
|
130
|
+
codePoint >= 65024 && codePoint <= 65039) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
if (codePoint >= 3633 && codePoint <= 3642 || // Thai vowel marks and tone marks
|
|
134
|
+
codePoint >= 3655 && codePoint <= 3662 || // Thai diacritics
|
|
135
|
+
codePoint >= 3761 && codePoint <= 3769 || // Lao vowel marks
|
|
136
|
+
codePoint >= 3771 && codePoint <= 3772 || // Lao vowel signs
|
|
137
|
+
codePoint >= 3784 && codePoint <= 3789) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
if (codePoint >= 2304 && codePoint <= 2307 || // Devanagari signs
|
|
141
|
+
codePoint >= 2362 && codePoint <= 2383 || // Devanagari vowel signs and virama
|
|
142
|
+
codePoint >= 2385 && codePoint <= 2391 || // Devanagari stress marks
|
|
143
|
+
codePoint >= 2402 && codePoint <= 2403 || // Devanagari vowel signs
|
|
144
|
+
codePoint >= 2433 && codePoint <= 2435 || // Bengali signs
|
|
145
|
+
codePoint >= 2492 && codePoint <= 2500 || // Bengali vowel signs
|
|
146
|
+
codePoint >= 2509 && codePoint <= 2509 || // Bengali virama
|
|
147
|
+
codePoint >= 2561 && codePoint <= 2563 || // Gurmukhi signs
|
|
148
|
+
codePoint >= 2620 && codePoint <= 2637) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (codePoint >= 1611 && codePoint <= 1631 || // Arabic diacritics
|
|
152
|
+
codePoint >= 1648 && codePoint <= 1648 || // Arabic letter superscript alef
|
|
153
|
+
codePoint >= 1750 && codePoint <= 1773 || // Arabic small high signs
|
|
154
|
+
codePoint >= 2276 && codePoint <= 2302) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
if (codePoint >= 1425 && codePoint <= 1469 || // Hebrew points
|
|
158
|
+
codePoint >= 1471 && codePoint <= 1471 || // Hebrew point rafe
|
|
159
|
+
codePoint >= 1473 && codePoint <= 1474 || // Hebrew points
|
|
160
|
+
codePoint >= 1476 && codePoint <= 1477 || // Hebrew marks
|
|
161
|
+
codePoint >= 1479 && codePoint <= 1479) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
if (codePoint >= 3893 && codePoint <= 3893 || // Tibetan mark nada
|
|
165
|
+
codePoint >= 3895 && codePoint <= 3895 || // Tibetan mark nada
|
|
166
|
+
codePoint >= 3897 && codePoint <= 3897 || // Tibetan mark tsa phru
|
|
167
|
+
codePoint >= 3953 && codePoint <= 3966 || // Tibetan vowel signs
|
|
168
|
+
codePoint >= 3968 && codePoint <= 3972 || // Tibetan vowel signs and virama
|
|
169
|
+
codePoint >= 3974 && codePoint <= 3975) {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
return codePoint >= 768 && codePoint <= 777 || // Combining diacritical marks used in Vietnamese
|
|
173
|
+
codePoint >= 803 && codePoint <= 803;
|
|
174
|
+
}, "isCombiningCharacter");
|
|
175
|
+
const getStringTruncatedWidth = /* @__PURE__ */ __name((input, options = {}) => {
|
|
176
|
+
if (!input || input.length === 0) {
|
|
177
|
+
return { ellipsed: false, index: 0, truncated: false, width: 0 };
|
|
178
|
+
}
|
|
179
|
+
const config = {
|
|
180
|
+
truncation: {
|
|
181
|
+
ellipsis: options.ellipsis ?? "",
|
|
182
|
+
ellipsisWidth: options.ellipsisWidth ?? (options.ellipsis ? getStringTruncatedWidth(options.ellipsis, {
|
|
183
|
+
...options,
|
|
184
|
+
ellipsis: "",
|
|
185
|
+
ellipsisWidth: 0,
|
|
186
|
+
limit: Number.POSITIVE_INFINITY
|
|
187
|
+
}).width : 0),
|
|
188
|
+
limit: options.limit ?? Number.POSITIVE_INFINITY
|
|
189
|
+
},
|
|
190
|
+
width: {
|
|
191
|
+
ambiguous: options.ambiguousWidth ?? 1,
|
|
192
|
+
ambiguousIsNarrow: options.ambiguousIsNarrow ?? false,
|
|
193
|
+
ansi: options.ansiWidth ?? 0,
|
|
194
|
+
control: options.controlWidth ?? 0,
|
|
195
|
+
emoji: options.emojiWidth ?? 2,
|
|
196
|
+
fullWidth: options.fullWidth ?? 2,
|
|
197
|
+
halfWidth: options.halfWidth ?? 1,
|
|
198
|
+
regular: options.regularWidth ?? 1,
|
|
199
|
+
tab: options.tabWidth ?? 8,
|
|
200
|
+
wide: options.wideWidth ?? 2
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const truncationLimit = Math.max(0, config.truncation.limit - config.truncation.ellipsisWidth);
|
|
204
|
+
const { length } = input;
|
|
205
|
+
const useCaching = length > 1e4;
|
|
206
|
+
let index = 0;
|
|
207
|
+
let width = 0;
|
|
208
|
+
let truncationIndex = length;
|
|
209
|
+
let truncationEnabled = false;
|
|
210
|
+
const hasAnsi = input.includes("\x1B") || input.includes("");
|
|
211
|
+
while (index < length) {
|
|
212
|
+
if (hasAnsi && (input[index] === "\x1B" || input[index] === "")) {
|
|
213
|
+
RE_ANSI.lastIndex = index;
|
|
214
|
+
if (RE_ANSI.test(input)) {
|
|
215
|
+
const ansiLength = RE_ANSI.lastIndex - index;
|
|
216
|
+
const ansiWidth = options.countAnsiEscapeCodes ? ansiLength : config.width.ansi;
|
|
217
|
+
if (index + 3 < length && input.slice(index, index + 4) === "\x1B]8;") {
|
|
218
|
+
const startPos = RE_ANSI.lastIndex;
|
|
219
|
+
RE_ANSI_LINK_END.lastIndex = startPos;
|
|
220
|
+
if (RE_ANSI_LINK_END.test(input)) {
|
|
221
|
+
const endPos = RE_ANSI_LINK_END.lastIndex;
|
|
222
|
+
const textContent = input.slice(startPos, endPos - 5);
|
|
223
|
+
const textWidth = textContent.length;
|
|
224
|
+
if (width + textWidth > truncationLimit) {
|
|
225
|
+
truncationIndex = Math.min(truncationIndex, startPos);
|
|
226
|
+
if (width + textWidth > config.truncation.limit) {
|
|
227
|
+
truncationEnabled = true;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
width += textWidth;
|
|
232
|
+
index = endPos;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (width + ansiWidth > truncationLimit) {
|
|
237
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
238
|
+
if (width + ansiWidth > config.truncation.limit) {
|
|
239
|
+
truncationEnabled = true;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
width += ansiWidth;
|
|
244
|
+
index = RE_ANSI.lastIndex;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const charCode = input.codePointAt(index);
|
|
249
|
+
if (charCode === 8203 || charCode === 65279 || charCode >= 8288 && charCode <= 8292) {
|
|
250
|
+
index++;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
if (charCode === 9) {
|
|
254
|
+
if (width + config.width.tab > truncationLimit) {
|
|
255
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
256
|
+
if (width + config.width.tab > config.truncation.limit) {
|
|
257
|
+
truncationEnabled = true;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
width += config.width.tab;
|
|
262
|
+
index++;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
RE_LATIN_CHARS.lastIndex = index;
|
|
266
|
+
if (RE_LATIN_CHARS.test(input)) {
|
|
267
|
+
const latinLength = RE_LATIN_CHARS.lastIndex - index;
|
|
268
|
+
const latinWidth = latinLength * config.width.regular;
|
|
269
|
+
if (width + latinWidth > truncationLimit) {
|
|
270
|
+
const charsToLimit = Math.floor((truncationLimit - width) / config.width.regular);
|
|
271
|
+
truncationIndex = Math.min(truncationIndex, index + charsToLimit);
|
|
272
|
+
if (width + latinWidth > config.truncation.limit) {
|
|
273
|
+
truncationEnabled = true;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
width += latinWidth;
|
|
278
|
+
index = RE_LATIN_CHARS.lastIndex;
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (charCode <= 31 || charCode >= 127 && charCode <= 159) {
|
|
282
|
+
RE_CONTROL.lastIndex = index;
|
|
283
|
+
if (RE_CONTROL.test(input)) {
|
|
284
|
+
const controlLength = RE_CONTROL.lastIndex - index;
|
|
285
|
+
const controlWidth = controlLength * config.width.control;
|
|
286
|
+
if (width + controlWidth > truncationLimit) {
|
|
287
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / config.width.control));
|
|
288
|
+
if (width + controlWidth > config.truncation.limit) {
|
|
289
|
+
truncationEnabled = true;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
width += controlWidth;
|
|
294
|
+
index = RE_CONTROL.lastIndex;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
RE_EMOJI.lastIndex = index;
|
|
299
|
+
if (RE_EMOJI.test(input)) {
|
|
300
|
+
if (width + config.width.emoji > truncationLimit) {
|
|
301
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
302
|
+
if (width + config.width.emoji > config.truncation.limit) {
|
|
303
|
+
truncationEnabled = true;
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
width += config.width.emoji;
|
|
308
|
+
index = RE_EMOJI.lastIndex;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
const codePoint = input.codePointAt(index) ?? 0;
|
|
312
|
+
if (isCombiningCharacter(codePoint)) {
|
|
313
|
+
index += codePoint > 65535 ? 2 : 1;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
let charWidth;
|
|
317
|
+
if (useCaching) {
|
|
318
|
+
charWidth = getCachedCharWidth(codePoint, config);
|
|
319
|
+
} else {
|
|
320
|
+
const charType = getCharType(codePoint);
|
|
321
|
+
switch (charType) {
|
|
322
|
+
case "latin": {
|
|
323
|
+
charWidth = config.width.regular;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
case "control": {
|
|
327
|
+
charWidth = config.width.control;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
case "wide": {
|
|
331
|
+
charWidth = config.width.wide;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case "zero": {
|
|
335
|
+
charWidth = 0;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
default: {
|
|
339
|
+
const eaw = eastAsianWidthType(codePoint);
|
|
340
|
+
switch (eaw) {
|
|
341
|
+
case "fullwidth": {
|
|
342
|
+
charWidth = config.width.fullWidth;
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
case "wide": {
|
|
346
|
+
charWidth = config.width.wide;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
case "ambiguous": {
|
|
350
|
+
charWidth = config.width.ambiguousIsNarrow ? config.width.regular : config.width.wide;
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
default: {
|
|
354
|
+
charWidth = config.width.regular;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (width + charWidth > truncationLimit) {
|
|
361
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
362
|
+
if (width + charWidth > config.truncation.limit) {
|
|
363
|
+
truncationEnabled = true;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
width += charWidth;
|
|
368
|
+
index += codePoint > 65535 ? 2 : 1;
|
|
369
|
+
}
|
|
370
|
+
let finalWidth = width;
|
|
371
|
+
if (truncationEnabled && config.truncation.limit >= config.truncation.ellipsisWidth) {
|
|
372
|
+
finalWidth = Math.min(truncationLimit + config.truncation.ellipsisWidth, config.truncation.limit);
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
ellipsed: truncationEnabled && config.truncation.limit >= config.truncation.ellipsisWidth,
|
|
376
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
377
|
+
truncated: truncationEnabled,
|
|
378
|
+
width: finalWidth
|
|
379
|
+
};
|
|
380
|
+
}, "getStringTruncatedWidth");
|
|
381
|
+
|
|
382
|
+
export { getStringTruncatedWidth };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const getStringTruncatedWidth = require('./get-string-truncated-width.cjs');
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
const getStringWidth = /* @__PURE__ */ __name((input, options = {}) => getStringTruncatedWidth.getStringTruncatedWidth(input, { ...options, ellipsis: "", ellipsisWidth: 0, limit: Number.POSITIVE_INFINITY }).width, "getStringWidth");
|
|
10
|
+
|
|
11
|
+
exports.getStringWidth = getStringWidth;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StringTruncatedWidthOptions } from './get-string-truncated-width.cjs';
|
|
2
|
+
|
|
3
|
+
type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
|
|
4
|
+
declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
|
|
5
|
+
|
|
6
|
+
export { type StringWidthOptions, getStringWidth };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StringTruncatedWidthOptions } from './get-string-truncated-width.mjs';
|
|
2
|
+
|
|
3
|
+
type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
|
|
4
|
+
declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
|
|
5
|
+
|
|
6
|
+
export { type StringWidthOptions, getStringWidth };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StringTruncatedWidthOptions } from './get-string-truncated-width.js';
|
|
2
|
+
|
|
3
|
+
type StringWidthOptions = Omit<StringTruncatedWidthOptions, "ellipsis" | "ellipsisWidth" | "limit">;
|
|
4
|
+
declare const getStringWidth: (input: string, options?: StringWidthOptions) => number;
|
|
5
|
+
|
|
6
|
+
export { type StringWidthOptions, getStringWidth };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getStringTruncatedWidth } from './get-string-truncated-width.mjs';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const getStringWidth = /* @__PURE__ */ __name((input, options = {}) => getStringTruncatedWidth(input, { ...options, ellipsis: "", ellipsisWidth: 0, limit: Number.POSITIVE_INFINITY }).width, "getStringWidth");
|
|
6
|
+
|
|
7
|
+
export { getStringWidth };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const case_camelCase = require('./case/camel-case.cjs');
|
|
6
|
+
const case_capitalCase = require('./case/capital-case.cjs');
|
|
7
|
+
const case_constantCase = require('./case/constant-case.cjs');
|
|
8
|
+
const case_dotCase = require('./case/dot-case.cjs');
|
|
9
|
+
const case_flatCase = require('./case/flat-case.cjs');
|
|
10
|
+
const case_flipCase = require('./case/flip-case.cjs');
|
|
11
|
+
const case_identifyCase = require('./case/identify-case.cjs');
|
|
12
|
+
const case_kebabCase = require('./case/kebab-case.cjs');
|
|
13
|
+
const case_lowerFirst = require('./case/lower-first.cjs');
|
|
14
|
+
const case_noCase = require('./case/no-case.cjs');
|
|
15
|
+
const case_pascalCase = require('./case/pascal-case.cjs');
|
|
16
|
+
const case_pascalSnakeCase = require('./case/pascal-snake-case.cjs');
|
|
17
|
+
const case_pathCase = require('./case/path-case.cjs');
|
|
18
|
+
const case_sentenceCase = require('./case/sentence-case.cjs');
|
|
19
|
+
const case_snakeCase = require('./case/snake-case.cjs');
|
|
20
|
+
const case_splitByCase = require('./case/split-by-case.cjs');
|
|
21
|
+
const case_titleCase = require('./case/title-case.cjs');
|
|
22
|
+
const case_trainCase = require('./case/train-case.cjs');
|
|
23
|
+
const case_upperFirst = require('./case/upper-first.cjs');
|
|
24
|
+
const joinSegments = require('./packem_shared/joinSegments-BH1CT4dK.cjs');
|
|
25
|
+
const getStringTruncatedWidth = require('./get-string-truncated-width.cjs');
|
|
26
|
+
const getStringWidth = require('./get-string-width.cjs');
|
|
27
|
+
const outdent = require('./outdent.cjs');
|
|
28
|
+
const slice = require('./slice.cjs');
|
|
29
|
+
const truncate = require('./truncate.cjs');
|
|
30
|
+
const WrapMode = require('./packem_shared/WrapMode-ZqTeXK8X.cjs');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
exports.camelCase = case_camelCase;
|
|
35
|
+
exports.capitalCase = case_capitalCase;
|
|
36
|
+
exports.constantCase = case_constantCase;
|
|
37
|
+
exports.dotCase = case_dotCase;
|
|
38
|
+
exports.flatCase = case_flatCase;
|
|
39
|
+
exports.flipCase = case_flipCase.flipCase;
|
|
40
|
+
exports.identifyCase = case_identifyCase;
|
|
41
|
+
exports.kebabCase = case_kebabCase.kebabCase;
|
|
42
|
+
exports.lowerFirst = case_lowerFirst;
|
|
43
|
+
exports.noCase = case_noCase;
|
|
44
|
+
exports.pascalCase = case_pascalCase;
|
|
45
|
+
exports.pascalSnakeCase = case_pascalSnakeCase;
|
|
46
|
+
exports.pathCase = case_pathCase;
|
|
47
|
+
exports.sentenceCase = case_sentenceCase;
|
|
48
|
+
exports.snakeCase = case_snakeCase;
|
|
49
|
+
exports.splitByCase = case_splitByCase.splitByCase;
|
|
50
|
+
exports.titleCase = case_titleCase;
|
|
51
|
+
exports.trainCase = case_trainCase;
|
|
52
|
+
exports.upperFirst = case_upperFirst;
|
|
53
|
+
exports.joinSegments = joinSegments;
|
|
54
|
+
exports.getStringTruncatedWidth = getStringTruncatedWidth.getStringTruncatedWidth;
|
|
55
|
+
exports.getStringWidth = getStringWidth.getStringWidth;
|
|
56
|
+
exports.outdent = outdent.outdent;
|
|
57
|
+
exports.slice = slice.slice;
|
|
58
|
+
exports.truncate = truncate.truncate;
|
|
59
|
+
exports.WrapMode = WrapMode.WrapMode;
|
|
60
|
+
exports.wordWrap = WrapMode.wordWrap;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { default as camelCase } from './case/camel-case.cjs';
|
|
2
|
+
export { default as capitalCase } from './case/capital-case.cjs';
|
|
3
|
+
export { default as constantCase } from './case/constant-case.cjs';
|
|
4
|
+
export { default as dotCase } from './case/dot-case.cjs';
|
|
5
|
+
export { default as flatCase } from './case/flat-case.cjs';
|
|
6
|
+
export { FlipOptions, flipCase } from './case/flip-case.cjs';
|
|
7
|
+
export { default as identifyCase } from './case/identify-case.cjs';
|
|
8
|
+
export { KebabCaseOptions, kebabCase } from './case/kebab-case.cjs';
|
|
9
|
+
export { default as lowerFirst } from './case/lower-first.cjs';
|
|
10
|
+
export { default as noCase } from './case/no-case.cjs';
|
|
11
|
+
export { default as pascalCase } from './case/pascal-case.cjs';
|
|
12
|
+
export { default as pascalSnakeCase } from './case/pascal-snake-case.cjs';
|
|
13
|
+
export { default as pathCase } from './case/path-case.cjs';
|
|
14
|
+
export { default as sentenceCase } from './case/sentence-case.cjs';
|
|
15
|
+
export { default as snakeCase } from './case/snake-case.cjs';
|
|
16
|
+
export { SplitOptions, splitByCase } from './case/split-by-case.cjs';
|
|
17
|
+
export { default as titleCase } from './case/title-case.cjs';
|
|
18
|
+
export { default as trainCase } from './case/train-case.cjs';
|
|
19
|
+
export { 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-D2-6p7t1.cjs';
|
|
20
|
+
export { default as upperFirst } from './case/upper-first.cjs';
|
|
21
|
+
export { joinSegments } from './case/index.cjs';
|
|
22
|
+
export { StringTruncatedWidthOptions, StringTruncatedWidthResult, getStringTruncatedWidth } from './get-string-truncated-width.cjs';
|
|
23
|
+
export { StringWidthOptions, getStringWidth } from './get-string-width.cjs';
|
|
24
|
+
export { Outdent, Options as OutdentOptions, outdent } from './outdent.cjs';
|
|
25
|
+
export { SliceOptions, slice } from './slice.cjs';
|
|
26
|
+
export { TruncateOptions, truncate } from './truncate.cjs';
|
|
27
|
+
export { A as All, j as Any, C as CharAt, a as Concat, E as EndsWith, I as Includes, k as IsBooleanLiteral, l as IsNumberLiteral, m as IsStringLiteral, n as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, P as PadEnd, b as PadStart, o as Repeat, R as Replace, c as ReplaceAll, p as Reverse, S as Slice, d as Split, e as StartsWith, T as ToLowerCase, f as ToUpperCase, g as Trim, h as TrimEnd, i as TrimStart } from './packem_shared/types-BNbQJg02.cjs';
|
|
28
|
+
import './utils.cjs';
|
|
29
|
+
|
|
30
|
+
declare const WrapMode: {
|
|
31
|
+
readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
|
|
32
|
+
readonly PRESERVE_WORDS: "PRESERVE_WORDS";
|
|
33
|
+
readonly STRICT_WIDTH: "STRICT_WIDTH";
|
|
34
|
+
};
|
|
35
|
+
interface WordWrapOptions {
|
|
36
|
+
removeZeroWidthCharacters?: boolean;
|
|
37
|
+
trim?: boolean;
|
|
38
|
+
width?: number;
|
|
39
|
+
wrapMode?: keyof typeof WrapMode;
|
|
40
|
+
}
|
|
41
|
+
declare const wordWrap: (string: string, options?: WordWrapOptions) => string;
|
|
42
|
+
|
|
43
|
+
export { type WordWrapOptions, WrapMode, wordWrap };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { default as camelCase } from './case/camel-case.mjs';
|
|
2
|
+
export { default as capitalCase } from './case/capital-case.mjs';
|
|
3
|
+
export { default as constantCase } from './case/constant-case.mjs';
|
|
4
|
+
export { default as dotCase } from './case/dot-case.mjs';
|
|
5
|
+
export { default as flatCase } from './case/flat-case.mjs';
|
|
6
|
+
export { FlipOptions, flipCase } from './case/flip-case.mjs';
|
|
7
|
+
export { default as identifyCase } from './case/identify-case.mjs';
|
|
8
|
+
export { KebabCaseOptions, kebabCase } from './case/kebab-case.mjs';
|
|
9
|
+
export { default as lowerFirst } from './case/lower-first.mjs';
|
|
10
|
+
export { default as noCase } from './case/no-case.mjs';
|
|
11
|
+
export { default as pascalCase } from './case/pascal-case.mjs';
|
|
12
|
+
export { default as pascalSnakeCase } from './case/pascal-snake-case.mjs';
|
|
13
|
+
export { default as pathCase } from './case/path-case.mjs';
|
|
14
|
+
export { default as sentenceCase } from './case/sentence-case.mjs';
|
|
15
|
+
export { default as snakeCase } from './case/snake-case.mjs';
|
|
16
|
+
export { SplitOptions, splitByCase } from './case/split-by-case.mjs';
|
|
17
|
+
export { default as titleCase } from './case/title-case.mjs';
|
|
18
|
+
export { default as trainCase } from './case/train-case.mjs';
|
|
19
|
+
export { 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-BAd3WDHo.mjs';
|
|
20
|
+
export { default as upperFirst } from './case/upper-first.mjs';
|
|
21
|
+
export { joinSegments } from './case/index.mjs';
|
|
22
|
+
export { StringTruncatedWidthOptions, StringTruncatedWidthResult, getStringTruncatedWidth } from './get-string-truncated-width.mjs';
|
|
23
|
+
export { StringWidthOptions, getStringWidth } from './get-string-width.mjs';
|
|
24
|
+
export { Outdent, Options as OutdentOptions, outdent } from './outdent.mjs';
|
|
25
|
+
export { SliceOptions, slice } from './slice.mjs';
|
|
26
|
+
export { TruncateOptions, truncate } from './truncate.mjs';
|
|
27
|
+
export { A as All, j as Any, C as CharAt, a as Concat, E as EndsWith, I as Includes, k as IsBooleanLiteral, l as IsNumberLiteral, m as IsStringLiteral, n as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, P as PadEnd, b as PadStart, o as Repeat, R as Replace, c as ReplaceAll, p as Reverse, S as Slice, d as Split, e as StartsWith, T as ToLowerCase, f as ToUpperCase, g as Trim, h as TrimEnd, i as TrimStart } from './packem_shared/types-BNbQJg02.mjs';
|
|
28
|
+
import './utils.mjs';
|
|
29
|
+
|
|
30
|
+
declare const WrapMode: {
|
|
31
|
+
readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
|
|
32
|
+
readonly PRESERVE_WORDS: "PRESERVE_WORDS";
|
|
33
|
+
readonly STRICT_WIDTH: "STRICT_WIDTH";
|
|
34
|
+
};
|
|
35
|
+
interface WordWrapOptions {
|
|
36
|
+
removeZeroWidthCharacters?: boolean;
|
|
37
|
+
trim?: boolean;
|
|
38
|
+
width?: number;
|
|
39
|
+
wrapMode?: keyof typeof WrapMode;
|
|
40
|
+
}
|
|
41
|
+
declare const wordWrap: (string: string, options?: WordWrapOptions) => string;
|
|
42
|
+
|
|
43
|
+
export { type WordWrapOptions, WrapMode, wordWrap };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { default as camelCase } from './case/camel-case.js';
|
|
2
|
+
export { default as capitalCase } from './case/capital-case.js';
|
|
3
|
+
export { default as constantCase } from './case/constant-case.js';
|
|
4
|
+
export { default as dotCase } from './case/dot-case.js';
|
|
5
|
+
export { default as flatCase } from './case/flat-case.js';
|
|
6
|
+
export { FlipOptions, flipCase } from './case/flip-case.js';
|
|
7
|
+
export { default as identifyCase } from './case/identify-case.js';
|
|
8
|
+
export { KebabCaseOptions, kebabCase } from './case/kebab-case.js';
|
|
9
|
+
export { default as lowerFirst } from './case/lower-first.js';
|
|
10
|
+
export { default as noCase } from './case/no-case.js';
|
|
11
|
+
export { default as pascalCase } from './case/pascal-case.js';
|
|
12
|
+
export { default as pascalSnakeCase } from './case/pascal-snake-case.js';
|
|
13
|
+
export { default as pathCase } from './case/path-case.js';
|
|
14
|
+
export { default as sentenceCase } from './case/sentence-case.js';
|
|
15
|
+
export { default as snakeCase } from './case/snake-case.js';
|
|
16
|
+
export { SplitOptions, splitByCase } from './case/split-by-case.js';
|
|
17
|
+
export { default as titleCase } from './case/title-case.js';
|
|
18
|
+
export { default as trainCase } from './case/train-case.js';
|
|
19
|
+
export { 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-BttWSSIk.js';
|
|
20
|
+
export { default as upperFirst } from './case/upper-first.js';
|
|
21
|
+
export { joinSegments } from './case/index.js';
|
|
22
|
+
export { StringTruncatedWidthOptions, StringTruncatedWidthResult, getStringTruncatedWidth } from './get-string-truncated-width.js';
|
|
23
|
+
export { StringWidthOptions, getStringWidth } from './get-string-width.js';
|
|
24
|
+
export { Outdent, Options as OutdentOptions, outdent } from './outdent.js';
|
|
25
|
+
export { SliceOptions, slice } from './slice.js';
|
|
26
|
+
export { TruncateOptions, truncate } from './truncate.js';
|
|
27
|
+
export { A as All, j as Any, C as CharAt, a as Concat, E as EndsWith, I as Includes, k as IsBooleanLiteral, l as IsNumberLiteral, m as IsStringLiteral, n as IsStringLiteralArray, J as Join, L as Length, M as Math, N as NodeLocale, P as PadEnd, b as PadStart, o as Repeat, R as Replace, c as ReplaceAll, p as Reverse, S as Slice, d as Split, e as StartsWith, T as ToLowerCase, f as ToUpperCase, g as Trim, h as TrimEnd, i as TrimStart } from './packem_shared/types-BNbQJg02.js';
|
|
28
|
+
import './utils.js';
|
|
29
|
+
|
|
30
|
+
declare const WrapMode: {
|
|
31
|
+
readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
|
|
32
|
+
readonly PRESERVE_WORDS: "PRESERVE_WORDS";
|
|
33
|
+
readonly STRICT_WIDTH: "STRICT_WIDTH";
|
|
34
|
+
};
|
|
35
|
+
interface WordWrapOptions {
|
|
36
|
+
removeZeroWidthCharacters?: boolean;
|
|
37
|
+
trim?: boolean;
|
|
38
|
+
width?: number;
|
|
39
|
+
wrapMode?: keyof typeof WrapMode;
|
|
40
|
+
}
|
|
41
|
+
declare const wordWrap: (string: string, options?: WordWrapOptions) => string;
|
|
42
|
+
|
|
43
|
+
export { type WordWrapOptions, WrapMode, wordWrap };
|