@visulima/string 3.0.0 → 3.1.1
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 +21 -0
- package/LICENSE.md +55 -129
- package/README.md +2 -2
- package/dist/align-text.d.ts +29 -29
- package/dist/align-text.js +2 -2
- package/dist/case/camel-case.d.ts +16 -16
- package/dist/case/camel-case.js +1 -1
- package/dist/case/capital-case.d.ts +13 -13
- package/dist/case/capital-case.js +1 -1
- package/dist/case/constant-case.d.ts +13 -13
- package/dist/case/constant-case.js +1 -1
- package/dist/case/dot-case.d.ts +13 -13
- package/dist/case/dot-case.js +1 -1
- package/dist/case/flat-case.d.ts +11 -11
- package/dist/case/flat-case.js +1 -1
- package/dist/case/flip-case.d.ts +14 -14
- package/dist/case/flip-case.js +1 -1
- package/dist/case/identify-case.d.ts +14 -14
- package/dist/case/identify-case.js +1 -1
- package/dist/case/index.d.ts +7 -7
- package/dist/case/index.js +1 -1
- package/dist/case/kebab-case.d.ts +22 -22
- package/dist/case/kebab-case.js +1 -1
- package/dist/case/lower-first.d.ts +12 -12
- package/dist/case/lower-first.js +1 -1
- package/dist/case/no-case.d.ts +13 -13
- package/dist/case/no-case.js +1 -1
- package/dist/case/pascal-case.d.ts +16 -16
- package/dist/case/pascal-case.js +1 -1
- package/dist/case/pascal-snake-case.d.ts +13 -13
- package/dist/case/pascal-snake-case.js +1 -1
- package/dist/case/path-case.d.ts +13 -13
- package/dist/case/path-case.js +1 -1
- package/dist/case/sentence-case.d.ts +13 -13
- package/dist/case/sentence-case.js +1 -1
- package/dist/case/snake-case.d.ts +13 -13
- package/dist/case/snake-case.js +1 -1
- package/dist/case/split-by-case.d.ts +20 -20
- package/dist/case/split-by-case.js +1 -1
- package/dist/case/title-case.d.ts +11 -11
- package/dist/case/title-case.js +1 -1
- package/dist/case/train-case.d.ts +13 -13
- package/dist/case/train-case.js +1 -1
- package/dist/case/upper-first.d.ts +12 -12
- package/dist/case/upper-first.js +1 -1
- package/dist/closest-string.d.ts +28 -28
- package/dist/closest-string.js +1 -1
- package/dist/compare-similarity.d.ts +33 -33
- package/dist/compare-similarity.js +1 -1
- package/dist/count-occurrences.d.ts +6 -6
- package/dist/count-occurrences.js +1 -1
- package/dist/direction.d.ts +4 -4
- package/dist/direction.js +1 -1
- package/dist/east-asian-width.d.ts +25 -15
- package/dist/east-asian-width.js +1 -1
- package/dist/excerpt.d.ts +18 -18
- package/dist/excerpt.js +55 -44
- package/dist/get-string-truncated-width.d.ts +131 -131
- package/dist/get-string-truncated-width.js +1 -1
- package/dist/get-string-width.d.ts +56 -56
- package/dist/indent.d.ts +11 -8
- package/dist/indent.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/is-fullwidth-code-point.d.ts +4 -4
- package/dist/is-fullwidth-code-point.js +1 -1
- package/dist/levenshtein.d.ts +19 -19
- package/dist/levenshtein.js +1 -1
- package/dist/native-string-types.d.ts +212 -228
- package/dist/outdent.d.ts +64 -64
- package/dist/outdent.js +1 -1
- package/dist/packem_shared/{_isFullWidth-Dqc3MWgl.js → _isFullWidth-dWWDw5Is.js} +1 -1
- package/dist/packem_shared/ansi-state-tracker-BFhXTS-5.js +1 -0
- package/dist/packem_shared/closest-CSX4px2F.js +1 -0
- package/dist/packem_shared/constants-BGGeBKGT.js +1 -0
- package/dist/packem_shared/dedent-CDXp3nZQ.js +1 -0
- package/dist/packem_shared/eastAsianWidth-DACe9Ds2.js +1 -0
- package/dist/packem_shared/generate-cache-key-th9N8-CB.js +1 -0
- package/dist/packem_shared/indent-CY079Qyq.js +1 -0
- package/dist/packem_shared/joinSegments-9qx7xSy7.js +1 -0
- package/dist/packem_shared/{lru-cache-BtMSrYQJ.js → lru-cache-BD25OaEQ.js} +1 -1
- package/dist/packem_shared/normalize-german-eszett-DtW4F-Wg.js +1 -0
- package/dist/packem_shared/redent-lctoaAtw.js +1 -0
- package/dist/packem_shared/strip-vt-control-characters-vMeu7uFw.js +1 -0
- package/dist/packem_shared/types.d-CMNqA5bi.d.ts +402 -0
- package/dist/packem_shared/types.d-LgsTR37y.d.ts +360 -0
- package/dist/replace-string.d.ts +7 -7
- package/dist/replace-string.js +1 -1
- package/dist/slice.d.ts +38 -38
- package/dist/slice.js +1 -1
- package/dist/slugify.d.ts +9 -9
- package/dist/slugify.js +1 -1
- package/dist/test/utils.d.ts +14 -14
- package/dist/test/utils.js +11 -11
- package/dist/test/vitest.d.ts +2 -2
- package/dist/transliterate.d.ts +7 -7
- package/dist/transliterate.js +3 -3
- package/dist/truncate.d.ts +37 -37
- package/dist/truncate.js +1 -1
- package/dist/utilities.d.ts +23 -23
- package/dist/utilities.js +1 -1
- package/dist/word-similarity-sort.d.ts +32 -32
- package/dist/word-similarity-sort.js +1 -1
- package/dist/word-wrap.d.ts +33 -33
- package/dist/word-wrap.js +5 -7
- package/package.json +1 -1
- package/dist/packem_shared/closest-C6YDQs4m.js +0 -1
- package/dist/packem_shared/constants-aPzGW29R.js +0 -1
- package/dist/packem_shared/dedent-CPjAYUXh.js +0 -1
- package/dist/packem_shared/eastAsianWidth-DJV8Kqd-.js +0 -1
- package/dist/packem_shared/generate-cache-key-BqU1Cqwm.js +0 -1
- package/dist/packem_shared/indent-cz8WMI0e.js +0 -1
- package/dist/packem_shared/joinSegments-CaHT-45s.js +0 -1
- package/dist/packem_shared/normalize-german-eszett-hNMwtGjd.js +0 -1
- package/dist/packem_shared/redent-ByOoJ6fN.js +0 -1
- package/dist/packem_shared/types.d-CmNvyl4l.d.ts +0 -360
- package/dist/packem_shared/types.d-fhe030jX.d.ts +0 -402
package/dist/case/flip-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{s as C}from"../packem_shared/constants-BGGeBKGT.js";import{L as m}from"../packem_shared/lru-cache-BD25OaEQ.js";import{s as p}from"../packem_shared/strip-vt-control-characters-vMeu7uFw.js";import{g}from"../packem_shared/generate-cache-key-th9N8-CB.js";const d=new m(1e3),x=(c,t)=>{if(typeof c!="string"||c.length===0)return"";const h=t?.cache??!1,o=t?.cacheStore??d;let a;if(h&&(a=g(c,t)),h&&a&&o.has(a))return o.get(a);let e=c;t?.stripEmoji&&(e=C(e)),t?.stripAnsi&&(e=p(e));let s="",r=0;for(;r<e.length;){if(t?.handleAnsi&&e[r]==="\x1B"){let f=e[r];for(r+=1;r<e.length&&e[r]!=="m";)f+=e[r],r+=1;r<e.length&&(f+=e[r],s+=f),r+=1;continue}const l=e[r],n=t?.locale?l.toLocaleLowerCase(t.locale):l.toLowerCase();let i;l===n?i=t?.locale?l.toLocaleUpperCase(t.locale):l.toUpperCase():i=n,s+=i,r+=1}return h&&a&&o.set(a,s),s};export{x as flipCase};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { I as IdentifyCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { I as IdentifyCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Identifies the case style of a string.
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* identifyCase("fooBar") // => "camel"
|
|
8
|
-
* identifyCase("FooBar") // => "pascal"
|
|
9
|
-
* identifyCase("foo_bar") // => "snake"
|
|
10
|
-
* identifyCase("foo-bar") // => "kebab"
|
|
11
|
-
* identifyCase("foo") // => "lower"
|
|
12
|
-
* identifyCase("FOO") // => "upper"
|
|
13
|
-
* identifyCase("FooBAR") // => "mixed"
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
4
|
+
* Identifies the case style of a string.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* identifyCase("fooBar") // => "camel"
|
|
8
|
+
* identifyCase("FooBar") // => "pascal"
|
|
9
|
+
* identifyCase("foo_bar") // => "snake"
|
|
10
|
+
* identifyCase("foo-bar") // => "kebab"
|
|
11
|
+
* identifyCase("foo") // => "lower"
|
|
12
|
+
* identifyCase("FOO") // => "upper"
|
|
13
|
+
* identifyCase("FooBAR") // => "mixed"
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
16
|
declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
|
|
17
17
|
export { identifyCase as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e=/^([A-Z][a-z]*)+$/,s=/[a-z]/i,E=/^[A-Z0-9_]+$/,_=/^[a-z0-9_]+$/,i=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,S=/^[a-z ]+$/,A=/^[A-Z][A-Z0-9]*$/,o=/\s+/,c=/^\d+$/,I=/^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/,f=/^[a-z]/,C=/[.!?;:,](?!\s|$)/,u=t=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(!t||!s.test(t))return"unknown";if(t.includes("_"))return E.test(t)?"upper_snake":_.test(t)?"snake":"mixed";if(t.includes("-"))return i.test(t)?"kebab":"mixed";if(S.test(t))return"lower";if(A.test(t))return"upper";const n=t.split(o);return n.length>1&&n.every(r=>e.test(r))||n.length>1&&c.test(n[0])&&e.test(n[1])?"title":n.length>1&&e.test(n[0])&&f.test(n[1])?"sentence":e.test(t)?"pascal":I.test(t)?"camel":C.test(t)?"unknown":"mixed"};export{u as default};
|
package/dist/case/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { N as NodeLocale } from "../packem_shared/types.d-
|
|
1
|
+
export type { N as NodeLocale } from "../packem_shared/types.d-LgsTR37y.js";
|
|
2
2
|
export { default as camelCase } from "./camel-case.js";
|
|
3
3
|
export { default as capitalCase } from "./capital-case.js";
|
|
4
4
|
export { default as constantCase } from "./constant-case.js";
|
|
@@ -17,13 +17,13 @@ export { default as snakeCase } from "./snake-case.js";
|
|
|
17
17
|
export { type SplitOptions, splitByCase } from "./split-by-case.js";
|
|
18
18
|
export { default as titleCase } from "./title-case.js";
|
|
19
19
|
export { default as trainCase } from "./train-case.js";
|
|
20
|
-
export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "../packem_shared/types.d-
|
|
20
|
+
export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
21
21
|
export { default as upperFirst } from "./upper-first.js";
|
|
22
22
|
/**
|
|
23
|
-
* Joins segments with a joiner, handling ANSI sequences and emojis correctly.
|
|
24
|
-
* @param segments Array of segments to join
|
|
25
|
-
* @param joiner String used to join segments together
|
|
26
|
-
* @returns Joined string with proper handling of ANSI and emoji sequences
|
|
27
|
-
*/
|
|
23
|
+
* Joins segments with a joiner, handling ANSI sequences and emojis correctly.
|
|
24
|
+
* @param segments Array of segments to join
|
|
25
|
+
* @param joiner String used to join segments together
|
|
26
|
+
* @returns Joined string with proper handling of ANSI and emoji sequences
|
|
27
|
+
*/
|
|
28
28
|
declare const joinSegments: (segments: string[], joiner: string) => string;
|
|
29
29
|
export { joinSegments };
|
package/dist/case/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"./camel-case.js";import{default as r}from"./capital-case.js";import{default as f}from"./constant-case.js";import{default as l}from"./dot-case.js";import{default as x}from"./flat-case.js";import{flipCase as u}from"./flip-case.js";import{default as n}from"./identify-case.js";import{kebabCase as c}from"./kebab-case.js";import{default as b}from"./lower-first.js";import{default as F}from"./no-case.js";import{default as g}from"./pascal-case.js";import{default as j}from"./pascal-snake-case.js";import{default as B}from"./path-case.js";import{default as v}from"./sentence-case.js";import{default as A}from"./snake-case.js";import{splitByCase as E}from"./split-by-case.js";import{default as H}from"./title-case.js";import{default as J}from"./train-case.js";import{default as L}from"./upper-first.js";import{default as N}from"../packem_shared/joinSegments-
|
|
1
|
+
import{default as t}from"./camel-case.js";import{default as r}from"./capital-case.js";import{default as f}from"./constant-case.js";import{default as l}from"./dot-case.js";import{default as x}from"./flat-case.js";import{flipCase as u}from"./flip-case.js";import{default as n}from"./identify-case.js";import{kebabCase as c}from"./kebab-case.js";import{default as b}from"./lower-first.js";import{default as F}from"./no-case.js";import{default as g}from"./pascal-case.js";import{default as j}from"./pascal-snake-case.js";import{default as B}from"./path-case.js";import{default as v}from"./sentence-case.js";import{default as A}from"./snake-case.js";import{splitByCase as E}from"./split-by-case.js";import{default as H}from"./title-case.js";import{default as J}from"./train-case.js";import{default as L}from"./upper-first.js";import{default as N}from"../packem_shared/joinSegments-9qx7xSy7.js";export{t as camelCase,r as capitalCase,f as constantCase,l as dotCase,x as flatCase,u as flipCase,n as identifyCase,N as joinSegments,c as kebabCase,b as lowerFirst,F as noCase,g as pascalCase,j as pascalSnakeCase,B as pathCase,v as sentenceCase,A as snakeCase,E as splitByCase,H as titleCase,J as trainCase,L as upperFirst};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { b as CaseOptions, K as KebabCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, K as KebabCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
interface KebabCaseOptions extends CaseOptions {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
* String used to join words together in kebab case format.
|
|
6
|
+
* @default "-"
|
|
7
|
+
*/
|
|
8
8
|
joiner?: string;
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
* Whether to convert the result to uppercase.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
13
|
toUpperCase?: boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Converts a string to kebab-case.
|
|
17
|
-
* @param value The string to convert to kebab-case.
|
|
18
|
-
* @param options Configuration options for kebab-case conversion.
|
|
19
|
-
* @returns The converted kebab-case string.
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* kebabCase("fooBar") // => "foo-bar"
|
|
23
|
-
* kebabCase("foo bar") // => "foo-bar"
|
|
24
|
-
* kebabCase("foo_bar") // => "foo-bar"
|
|
25
|
-
* kebabCase("XMLHttpRequest") // => "xml-http-request"
|
|
26
|
-
* kebabCase("AJAXRequest") // => "ajax-request"
|
|
27
|
-
* kebabCase("QueryXML123String") // => "query-xml-123-string"
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
16
|
+
* Converts a string to kebab-case.
|
|
17
|
+
* @param value The string to convert to kebab-case.
|
|
18
|
+
* @param options Configuration options for kebab-case conversion.
|
|
19
|
+
* @returns The converted kebab-case string.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* kebabCase("fooBar") // => "foo-bar"
|
|
23
|
+
* kebabCase("foo bar") // => "foo-bar"
|
|
24
|
+
* kebabCase("foo_bar") // => "foo-bar"
|
|
25
|
+
* kebabCase("XMLHttpRequest") // => "xml-http-request"
|
|
26
|
+
* kebabCase("AJAXRequest") // => "ajax-request"
|
|
27
|
+
* kebabCase("QueryXML123String") // => "query-xml-123-string"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
30
|
declare const kebabCase: <T extends string = string>(value?: T, options?: KebabCaseOptions) => KebabCase<T>;
|
|
31
31
|
export { KebabCaseOptions, kebabCase };
|
package/dist/case/kebab-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"../packem_shared/constants-
|
|
1
|
+
import{c as o}from"../packem_shared/constants-BGGeBKGT.js";import{L as i}from"../packem_shared/lru-cache-BD25OaEQ.js";import{splitByCase as f}from"./split-by-case.js";import{g as h}from"../packem_shared/generate-cache-key-th9N8-CB.js";import C from"../packem_shared/joinSegments-9qx7xSy7.js";import{n as u}from"../packem_shared/normalize-german-eszett-DtW4F-Wg.js";const A=new i(1e3),g=(t,e)=>{if(typeof t!="string")return"";const c=e?.cache??!1,s=e?.cacheStore??A;let r;if(c&&(r=h(t,e)),c&&r&&s.has(r))return s.get(r);const m=f(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(a=>{if(e?.handleAnsi&&o.test(a))return a;if(e?.toUpperCase)return e.locale?a.toLocaleUpperCase(e.locale):a.toUpperCase();const n=e?.locale?.startsWith("de")?u(a):a;return e?.locale?n.toLocaleLowerCase(e.locale):n.toLowerCase()}),l=C(m,e?.joiner??"-");return c&&r&&s.set(r,l),l};export{g as kebabCase};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { L as LocaleOptions, e as LowerFirst } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { L as LocaleOptions, e as LowerFirst } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts first character to lower case.
|
|
5
|
-
* @param value The string to convert.
|
|
6
|
-
* @param options Options for case conversion.
|
|
7
|
-
* @returns The string with its first character converted to lowercase.
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* lowerFirst("Hello world!") // => "hello world!"
|
|
11
|
-
* lowerFirst("İSTANBUL", { locale: "tr" }) // => "istanbul"
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
4
|
+
* Converts first character to lower case.
|
|
5
|
+
* @param value The string to convert.
|
|
6
|
+
* @param options Options for case conversion.
|
|
7
|
+
* @returns The string with its first character converted to lowercase.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* lowerFirst("Hello world!") // => "hello world!"
|
|
11
|
+
* lowerFirst("İSTANBUL", { locale: "tr" }) // => "istanbul"
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
14
|
declare const lowerFirst: <T extends string = string>(value?: T, options?: LocaleOptions) => LowerFirst<T>;
|
|
15
15
|
export { lowerFirst as default };
|
package/dist/case/lower-first.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o=(r,t)=>typeof r!="string"||r===""?"":(t?.locale?r[0].toLocaleLowerCase(t.locale):r[0].toLowerCase())+r.slice(1);export{o as default};
|
package/dist/case/no-case.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { b as CaseOptions, N as NoCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, N as NoCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to no case (space separated words).
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* noCase("foo bar") // => "foo bar"
|
|
8
|
-
* noCase("foo-bar") // => "foo bar"
|
|
9
|
-
* noCase("foo_bar") // => "foo bar"
|
|
10
|
-
* noCase("XMLHttpRequest") // => "xml http request"
|
|
11
|
-
* noCase("AJAXRequest") // => "ajax request"
|
|
12
|
-
* noCase("QueryXML123String") // => "query xml 123 string"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
4
|
+
* Converts a string to no case (space separated words).
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* noCase("foo bar") // => "foo bar"
|
|
8
|
+
* noCase("foo-bar") // => "foo bar"
|
|
9
|
+
* noCase("foo_bar") // => "foo bar"
|
|
10
|
+
* noCase("XMLHttpRequest") // => "xml http request"
|
|
11
|
+
* noCase("AJAXRequest") // => "ajax request"
|
|
12
|
+
* noCase("QueryXML123String") // => "query xml 123 string"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
declare const noCase: <T extends string = string>(value?: T, options?: CaseOptions) => NoCase<T>;
|
|
16
16
|
export { noCase as default };
|
package/dist/case/no-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as a}from"../packem_shared/lru-cache-BD25OaEQ.js";import{kebabCase as t}from"./kebab-case.js";const r=new a(1e3),n=(e,o)=>t(e,{cacheStore:r,...o,joiner:" "});export{n as default};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { b as CaseOptions, P as PascalCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, P as PascalCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to PascalCase.
|
|
5
|
-
* @param value The string to convert.
|
|
6
|
-
* @param options Options for case conversion.
|
|
7
|
-
* @returns The string in PascalCase.
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* pascalCase('foo bar') // 'FooBar'
|
|
11
|
-
* pascalCase('foo-bar') // 'FooBar'
|
|
12
|
-
* pascalCase('foo_bar') // 'FooBar'
|
|
13
|
-
* pascalCase('XMLHttpRequest') // 'XmlHttpRequest'
|
|
14
|
-
* pascalCase('AJAXRequest') // 'AjaxRequest'
|
|
15
|
-
* pascalCase('QueryXML123String') // 'QueryXml123String'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
4
|
+
* Converts a string to PascalCase.
|
|
5
|
+
* @param value The string to convert.
|
|
6
|
+
* @param options Options for case conversion.
|
|
7
|
+
* @returns The string in PascalCase.
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* pascalCase('foo bar') // 'FooBar'
|
|
11
|
+
* pascalCase('foo-bar') // 'FooBar'
|
|
12
|
+
* pascalCase('foo_bar') // 'FooBar'
|
|
13
|
+
* pascalCase('XMLHttpRequest') // 'XmlHttpRequest'
|
|
14
|
+
* pascalCase('AJAXRequest') // 'AjaxRequest'
|
|
15
|
+
* pascalCase('QueryXML123String') // 'QueryXml123String'
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
18
|
declare const pascalCase: <T extends string = string>(value?: T, options?: CaseOptions) => PascalCase<T>;
|
|
19
19
|
export { pascalCase as default };
|
package/dist/case/pascal-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as n}from"../packem_shared/constants-BGGeBKGT.js";import{L as i}from"../packem_shared/lru-cache-BD25OaEQ.js";import{splitByCase as o}from"./split-by-case.js";import f from"./upper-first.js";import{g as h}from"../packem_shared/generate-cache-key-th9N8-CB.js";import A from"../packem_shared/joinSegments-9qx7xSy7.js";import{n as C}from"../packem_shared/normalize-german-eszett-DtW4F-Wg.js";const d=new i(1e3),L=(a,e)=>{if(typeof a!="string"||!a)return"";const c=e?.cache??!1,l=e?.cacheStore??d;let r;if(c&&(r=h(a,e)),c&&r&&l.has(r))return l.get(r);const s=A(o(a,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(t=>{if(e?.handleAnsi&&n.test(t))return t;const m=e?.locale?.startsWith("de")?C(t):t;return f(e?.locale?m.toLocaleLowerCase(e.locale):m.toLowerCase(),{locale:e?.locale})}),"");return c&&r&&l.set(r,s),s};export{L as default};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { b as CaseOptions, f as PascalSnakeCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, f as PascalSnakeCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to Pascal_Snake_Case.
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* pascalSnakeCase("foo bar") // => "Foo_Bar"
|
|
8
|
-
* pascalSnakeCase("foo-bar") // => "Foo_Bar"
|
|
9
|
-
* pascalSnakeCase("foo_bar") // => "Foo_Bar"
|
|
10
|
-
* pascalSnakeCase("XMLHttpRequest") // => "Xml_Http_Request"
|
|
11
|
-
* pascalSnakeCase("AJAXRequest") // => "Ajax_Request"
|
|
12
|
-
* pascalSnakeCase("QueryXML123String") // => "Query_Xml_123_String"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
4
|
+
* Converts a string to Pascal_Snake_Case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* pascalSnakeCase("foo bar") // => "Foo_Bar"
|
|
8
|
+
* pascalSnakeCase("foo-bar") // => "Foo_Bar"
|
|
9
|
+
* pascalSnakeCase("foo_bar") // => "Foo_Bar"
|
|
10
|
+
* pascalSnakeCase("XMLHttpRequest") // => "Xml_Http_Request"
|
|
11
|
+
* pascalSnakeCase("AJAXRequest") // => "Ajax_Request"
|
|
12
|
+
* pascalSnakeCase("QueryXML123String") // => "Query_Xml_123_String"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
declare const pascalSnakeCase: <T extends string = string>(value?: T, options?: CaseOptions) => PascalSnakeCase<T>;
|
|
16
16
|
export { pascalSnakeCase as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as f}from"../packem_shared/lru-cache-BD25OaEQ.js";import h from"./no-case.js";import l from"./upper-first.js";import{g as n}from"../packem_shared/generate-cache-key-th9N8-CB.js";const m=new f(1e3),g=(a,r)=>{if(typeof a!="string")return"";const t=r?.cache??!1,c=r?.cacheStore??m;let e;if(t&&(e=n(a,r)),t&&e&&c.has(e))return c.get(e);const s=h(a,{...r,cache:!1}).split(" ").map(o=>l(o,{locale:r?.locale})).join("_");return t&&e&&c.set(e,s),s};export{g as default};
|
package/dist/case/path-case.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { b as CaseOptions, g as PathCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, g as PathCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to path/case.
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* pathCase("foo bar") // => "foo/bar"
|
|
8
|
-
* pathCase("foo-bar") // => "foo/bar"
|
|
9
|
-
* pathCase("foo_bar") // => "foo/bar"
|
|
10
|
-
* pathCase("XMLHttpRequest") // => "xml/http/request"
|
|
11
|
-
* pathCase("AJAXRequest") // => "ajax/request"
|
|
12
|
-
* pathCase("QueryXML123String") // => "query/xml/123/string"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
4
|
+
* Converts a string to path/case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* pathCase("foo bar") // => "foo/bar"
|
|
8
|
+
* pathCase("foo-bar") // => "foo/bar"
|
|
9
|
+
* pathCase("foo_bar") // => "foo/bar"
|
|
10
|
+
* pathCase("XMLHttpRequest") // => "xml/http/request"
|
|
11
|
+
* pathCase("AJAXRequest") // => "ajax/request"
|
|
12
|
+
* pathCase("QueryXML123String") // => "query/xml/123/string"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
declare const pathCase: <T extends string = string>(value?: T, options?: CaseOptions) => PathCase<T>;
|
|
16
16
|
export { pathCase as default };
|
package/dist/case/path-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as o}from"../packem_shared/lru-cache-BD25OaEQ.js";import{kebabCase as t}from"./kebab-case.js";const r=new o(1e3),f=(e,a)=>t(e,{cacheStore:r,...a,joiner:"/"});export{f as default};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { b as CaseOptions, S as SentenceCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, S as SentenceCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to Sentence case.
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* sentenceCase("foo bar") // => "Foo bar"
|
|
8
|
-
* sentenceCase("foo-bar") // => "Foo bar"
|
|
9
|
-
* sentenceCase("foo_bar") // => "Foo bar"
|
|
10
|
-
* sentenceCase("XMLHttpRequest") // => "Xml http request"
|
|
11
|
-
* sentenceCase("AJAXRequest") // => "Ajax request"
|
|
12
|
-
* sentenceCase("QueryXML123String") // => "Query xml 123 string"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
4
|
+
* Converts a string to Sentence case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* sentenceCase("foo bar") // => "Foo bar"
|
|
8
|
+
* sentenceCase("foo-bar") // => "Foo bar"
|
|
9
|
+
* sentenceCase("foo_bar") // => "Foo bar"
|
|
10
|
+
* sentenceCase("XMLHttpRequest") // => "Xml http request"
|
|
11
|
+
* sentenceCase("AJAXRequest") // => "Ajax request"
|
|
12
|
+
* sentenceCase("QueryXML123String") // => "Query xml 123 string"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
declare const sentenceCase: <T extends string = string>(value?: T, options?: CaseOptions) => SentenceCase<T>;
|
|
16
16
|
export { sentenceCase as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"../packem_shared/constants-
|
|
1
|
+
import{c as o}from"../packem_shared/constants-BGGeBKGT.js";import{L as f}from"../packem_shared/lru-cache-BD25OaEQ.js";import{splitByCase as h}from"./split-by-case.js";import d from"./upper-first.js";import{g as u}from"../packem_shared/generate-cache-key-th9N8-CB.js";import A from"../packem_shared/joinSegments-9qx7xSy7.js";import{n as C}from"../packem_shared/normalize-german-eszett-DtW4F-Wg.js";const y=new f(1e3),w=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,c=e?.cacheStore??y;let r;if(s&&(r=u(t,e)),s&&r&&c.has(r))return c.get(r);let l=!0;const n=A(h(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(a=>{if(e?.handleAnsi&&o.test(a))return a;const m=e?.locale?.startsWith("de")?C(a):a,i=e?.locale?m.toLocaleLowerCase(e.locale):m.toLowerCase();return l?(l=!1,d(i,e)):i})," ");return s&&r&&c.set(r,n),n};export{w as default};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { b as CaseOptions, h as SnakeCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { b as CaseOptions, h as SnakeCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/**
|
|
4
|
-
* Converts a string to snake_case.
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* snakeCase("fooBar") // => "foo_bar"
|
|
8
|
-
* snakeCase("foo bar") // => "foo_bar"
|
|
9
|
-
* snakeCase("foo-bar") // => "foo_bar"
|
|
10
|
-
* snakeCase("XMLHttpRequest") // => "xml_http_request"
|
|
11
|
-
* snakeCase("AJAXRequest") // => "ajax_request"
|
|
12
|
-
* snakeCase("QueryXML123String") // => "query_xml_123_string"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
4
|
+
* Converts a string to snake_case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* snakeCase("fooBar") // => "foo_bar"
|
|
8
|
+
* snakeCase("foo bar") // => "foo_bar"
|
|
9
|
+
* snakeCase("foo-bar") // => "foo_bar"
|
|
10
|
+
* snakeCase("XMLHttpRequest") // => "xml_http_request"
|
|
11
|
+
* snakeCase("AJAXRequest") // => "ajax_request"
|
|
12
|
+
* snakeCase("QueryXML123String") // => "query_xml_123_string"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
declare const snakeCase: <T extends string = string>(value?: T, options?: CaseOptions) => SnakeCase<T>;
|
|
16
16
|
export { snakeCase as default };
|
package/dist/case/snake-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L as o}from"../packem_shared/lru-cache-BD25OaEQ.js";import{kebabCase as t}from"./kebab-case.js";const r=new o(1e3),n=(e,a)=>t(e,{cacheStore:r,...a,joiner:"_"});export{n as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LocaleOptions, i as SplitByCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
1
|
+
import { L as LocaleOptions, i as SplitByCase } from "../packem_shared/types.d-CMNqA5bi.js";
|
|
2
|
+
import "../packem_shared/types.d-LgsTR37y.js";
|
|
3
3
|
/** Options for the `splitByCase` function. */
|
|
4
4
|
interface SplitOptions extends LocaleOptions {
|
|
5
5
|
/** Whether to handle ANSI escape sequences. (default: false) */
|
|
@@ -18,23 +18,23 @@ interface SplitOptions extends LocaleOptions {
|
|
|
18
18
|
stripEmoji?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Splits a string into segments based on various criteria including case changes,
|
|
22
|
-
* separators, Unicode scripts, ANSI codes, and emojis.
|
|
23
|
-
*
|
|
24
|
-
* This is the core splitting logic used by various case conversion functions.
|
|
25
|
-
* @template T - The specific literal type of the input string, if known.
|
|
26
|
-
* @param input The string to split.
|
|
27
|
-
* @param options Configuration options for splitting behavior.
|
|
28
|
-
* @returns An array of string segments.
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* splitByCase("fooBarBaz") // => ["foo", "Bar", "Baz"]
|
|
32
|
-
* splitByCase("foo_bar-baz") // => ["foo", "bar", "baz"]
|
|
33
|
-
* splitByCase("HTMLElement") // => ["HTML", "Element"]
|
|
34
|
-
* splitByCase("HTMLElement", { knownAcronyms: ["HTML"] }) // => ["HTML", "Element"]
|
|
35
|
-
* splitByCase("\u001B[31mhello\u001B[0mWorld", { handleAnsi: true }) // => ["\u001B[31m", "hello", "\u001B[0m", "World"]
|
|
36
|
-
* splitByCase("hello🌍world", { handleEmoji: true }) // => ["hello", "🌍", "world"]
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
21
|
+
* Splits a string into segments based on various criteria including case changes,
|
|
22
|
+
* separators, Unicode scripts, ANSI codes, and emojis.
|
|
23
|
+
*
|
|
24
|
+
* This is the core splitting logic used by various case conversion functions.
|
|
25
|
+
* @template T - The specific literal type of the input string, if known.
|
|
26
|
+
* @param input The string to split.
|
|
27
|
+
* @param options Configuration options for splitting behavior.
|
|
28
|
+
* @returns An array of string segments.
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* splitByCase("fooBarBaz") // => ["foo", "Bar", "Baz"]
|
|
32
|
+
* splitByCase("foo_bar-baz") // => ["foo", "bar", "baz"]
|
|
33
|
+
* splitByCase("HTMLElement") // => ["HTML", "Element"]
|
|
34
|
+
* splitByCase("HTMLElement", { knownAcronyms: ["HTML"] }) // => ["HTML", "Element"]
|
|
35
|
+
* splitByCase("\u001B[31mhello\u001B[0mWorld", { handleAnsi: true }) // => ["\u001B[31m", "hello", "\u001B[0m", "World"]
|
|
36
|
+
* splitByCase("hello🌍world", { handleEmoji: true }) // => ["hello", "🌍", "world"]
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
39
|
declare const splitByCase: <T extends string = string>(input: T, options?: SplitOptions) => SplitByCase<T>;
|
|
40
40
|
export { SplitOptions, splitByCase };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{R as x,s as V,c as S,l as w,m as R,n as W,o as M,p as P,q as F,r as O,t as Y,u as B,v as D,w as G,x as q,y as $,z as Z,A as Q,B as X,C as tt,D as et,E as st,F as nt,G as rt,H as it,I as at,J as ot,K as pt,L as lt,M as ht,N as ct}from"../packem_shared/constants-BGGeBKGT.js";import{L as ft}from"../packem_shared/lru-cache-BD25OaEQ.js";import{s as ut}from"../packem_shared/strip-vt-control-characters-vMeu7uFw.js";const b=new ft(1e3),gt=/[.*+?^${}()|[\]\\]/g,dt=t=>{const i=t.join("");if(b.has(i)){const C=b.get(i);return C.lastIndex=0,C}const h=t.map(C=>C.replaceAll(gt,String.raw`\$&`)).join("|"),g=new RegExp(h,"g");return b.set(i,g),g},Ct=t=>{const i=[];let h=0,g;for(x.lastIndex=0;(g=x.exec(t))!==null;)g.index>h&&i.push(t.slice(h,g.index)),i.push(g[0]),h=x.lastIndex;return h<t.length&&i.push(t.slice(h)),i.filter(Boolean)},Et=/[ČŠŽĐ]/i,y=new Uint8Array(128),H=new Uint8Array(128),T=new Uint8Array(128);for(let t=0;t<128;t++)y[t]=t>=65&&t<=90?1:0,H[t]=t>=97&&t<=122?1:0,T[t]=t>=48&&t<=57?1:0;const k=t=>y[t],K=t=>H[t],N=t=>T[t],_=(t,i,h,g,C)=>{if(t.length===0)return[];let f=!1;const U=Object.values(i);for(const s of U)if(s(t[0])){f=!0;break}if(!f&&!h)return[t];const u=[...t],A=[];let e=u[0],a="other";const l=Object.entries(i);for(const s of l){const[r,p]=s;if(p(u[0])){a=r;break}}let n=h&&g?u[0]===u[0].toLocaleUpperCase(g):!1;for(let s=1;s<u.length;s++){const r=u[s];let p="other";for(const d of l){const[E,I]=d;if(I(r)){p=E;break}}const c=h&&g?r===r.toLocaleUpperCase(g):!1;let o=!1;C?o=C(a,p,n,c,r,s,u):(a!==p&&a!=="other"&&p!=="other"&&(o=!0),h&&p!=="other"&&!n&&c&&(o=!0)),o?(A.push(e),e=r):e+=r,a=p,h&&(n=c)}return e&&e.length>0&&A.push(e),A.length>0?A:[t]},At=(t,i,h,g)=>{if(h.size===0)return i;for(const C of h)if(t.startsWith(C,i))return g.push(C),i+C.length;return i},z=(t,i=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let h=0;const g=[],C=t.length;for(let f=1;f<C;f++){const U=At(t,h,i,g);if(U!==h){h=U,f=h-1;continue}const u=t.codePointAt(f-1),A=t.codePointAt(f),e=u&&u<128&&k(u),a=A&&A<128&&k(A),l=u&&u<128&&K(u),n=u&&u<128&&N(u),s=A&&A<128&&N(A);if(l&&a){g.push(t.slice(h,f)),h=f;continue}if(n&&!s||!n&&s){g.push(t.slice(h,f)),h=f;continue}if(s&&!n){let r=!1,p=!1;if(f+1<C){const c=t.codePointAt(f+1);r=c&&c<128&&k(c),p=c&&c<128&&N(c)}if(!p&&r){g.push(t.slice(h,f),t.slice(f,f+1)),h=f+1;continue}}if(f+1<C){const r=t.codePointAt(f+1),p=r&&r<128&&K(r);if(e&&a&&p){const c=t.slice(h,f+1);i.has(c)||(g.push(t.slice(h,f)),h=f)}}}return h<C&&g.push(t.slice(h)),g.filter(f=>f!=="")},v=(t,i,h)=>{if(t.length===0)return[];const g=t===t.toLocaleUpperCase(i);if(i.startsWith("de")){if(!g&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(i))return[t];const e=[...t],a=e.length,l=[];let n=e[0],s=e[0]===e[0].toLocaleUpperCase(i),r=s,p=s?0:-1;for(let c=1;c<a;c++){const o=e[c],d=o===o.toLocaleUpperCase(i);if(d===s)n+=o;else if(d)n&&n.length>0&&(l.push(n),n=o),r=!0,p=c;else{if(r&&c-p>1){const E=e[c-1],I=n.slice(0,-1);I&&I.length>0&&l.push(I),n=E+o}else n+=o;r=!1,p=-1}s=d}return n&&n.length>0&&l.push(n),l}if(i.startsWith("uk")||i.startsWith("ru")||i.startsWith("bg")||i.startsWith("sr")||i.startsWith("mk")||i.startsWith("be")){if(!w.test(t)&&!R.test(t))return[t];const e=[...t],a=e.length,l=[];let n=e[0];const s=e[0];let r;w.test(s)?r=1:R.test(s)?r=2:r=0;let p=s===s.toLocaleUpperCase(i);for(let o=1;o<a;o++){const d=e[o];let E;w.test(d)?E=1:R.test(d)?E=2:E=0;const I=d===d.toLocaleUpperCase(i);r!==E&&(r===1||r===2)&&(E===1||E===2)||E===r&&!p&&I?(l.push(n),n=d):n+=d,r=E,p=I}n&&n.length>0&&l.push(n);const c=[];for(let o=0;o<l.length;o++)o<l.length-1&&l[o].length===1&&R.test(l[o])&&w.test(l[o+1][0])?(c.push(l[o]+l[o+1]),o+=1):c.push(l[o]);return c}if(i.startsWith("el")){if(!W.test(t)&&!R.test(t))return[t];const e=[];M.lastIndex=0;let a;for(;(a=M.exec(t))!==null;)e.push(a[0]);e.length===0&&e.push(t);const l=[];if(e.length===1){const s=e[0];if(!s||!W.test(s[0])||s.length===1)return[s??t]}for(const s of e){if(!s)continue;if(!W.test(s[0])||s.length===1){l.push(s);continue}const r=s.length;let p=s[0],c=s[0]===s[0].toLocaleUpperCase(i);for(let o=1;o<r;o++){const d=s[o],E=d===d.toLocaleUpperCase(i);!c&&E?(l.push(p),p=d):p+=d,c=E}p&&l.push(p)}return l}if(i.startsWith("ja")||i.startsWith("ko")){const e=i.startsWith("ja"),a=e?{hiragana:n=>Y.test(n),kanji:n=>O.test(n),katakana:n=>F.test(n),latin:n=>R.test(n)}:{hangul:n=>B.test(n),latin:n=>R.test(n)},l=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(e){const n=_(t,a,!1,i,(r,p)=>r==="hiragana"&&p==="katakana"||r==="katakana"&&p==="hiragana"||r==="hiragana"&&p==="latin"||r==="katakana"&&p==="latin"||r==="kanji"&&p==="latin"||r==="latin"&&(p==="hiragana"||p==="katakana"||p==="kanji")),s=[];for(const r of n){const p=r;p.length===1&&l.has(p)&&s.length>0?s[s.length-1]=s.at(-1)+p:s.push(p)}return s.length>0?s:[t]}return _(t,a,!1,i,(n,s)=>n==="hangul"&&s==="latin"||n==="latin"&&s==="hangul")}if(i.startsWith("sl")){const e=[...t],a=e.length,l=[];let n=e[0],s=e[0]===e[0].toLocaleUpperCase(i);for(let r=1;r<a;r++){const p=e[r],c=p===p.toLocaleUpperCase(i),o=Et.test(p),d=r<a-1&&e[r+1]===e[r+1].toLocaleUpperCase(i);!s&&c||o&&d?(l.push(n),n=p,o&&d&&(l.push(n),n="")):n+=p,s=c}return n&&n.length>0&&l.push(n),l}if(i.startsWith("zh"))return _(t,{han:e=>O.test(e),latin:e=>R.test(e)},!1,i);if(["ar","fa","he","ur"].includes(i.split("-")[0])){const e=a=>D.test(a)||G.test(a);return _(t,{latin:a=>R.test(a),rtl:a=>e(a)},!1,i)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(i.split("-")[0])){const e=a=>$.test(a)||Z.test(a)||Q.test(a)||X.test(a)||tt.test(a)||et.test(a)||st.test(a)||nt.test(a)||rt.test(a)||it.test(a)||at.test(a)||ot.test(a)||pt.test(a)||lt.test(a)||ht.test(a)||ct.test(a);return _(t,{indic:a=>e(a),latin:a=>R.test(a)},!1,i)}if(["be","bg","ru","sr","uk"].includes(i))return _(t,{cyrillic:e=>w.test(e),latin:e=>R.test(e)},!0,i);if(["ar","fa","he"].includes(i))return _(t,{latin:e=>R.test(e),rtl:e=>D.test(e)||G.test(e)},!1,i);if(i.startsWith("ko"))return _(t,{hangul:e=>B.test(e),latin:e=>R.test(e)},!1,i);if(i.startsWith("uz")){if(!w.test(t)&&!R.test(t))return[t];const e=[...t],a=e.length,l=[];let n=e[0],s=e[0]===e[0].toLocaleUpperCase(i);for(let r=1;r<a;r++){const p=e[r],c=p===p.toLocaleUpperCase(i);if(P.test(p)||P.test(e[r-1])){n+=p;continue}!s&&c?(l.push(n),n=p):n+=p,s=c}return n&&n.length>0&&l.push(n),l}const C=[...t],f=C.length,U=[];let u=C[0],A=C[0]===C[0].toLocaleUpperCase(i);for(const e of h)if(t.startsWith(e)){U.push(e),u=C[e.length],A=u===u.toLocaleUpperCase(i);break}for(let e=1;e<f;e++){const a=C[e],l=a===a.toLocaleUpperCase(i);let n=0;for(const s of h)if(t.startsWith(s,e)){U.push(u,s),n=s.length,u="";const r=s.at(-1);r&&(A=r===r.toLocaleUpperCase(i));break}if(n>0){e+=n-1;continue}!A&&l?(U.push(u),u=a):u+=a,A=l}return u&&U.push(u),U},Ut=(t,i,h)=>{const g=[],C=S.test(t)?t.split(S).filter(Boolean):[t];for(const f of C){const U=f;if(S.test(U))g.push(U);else{x.lastIndex=0;const u=x.test(U)?Ct(U).filter(Boolean):[U];for(const A of u)if(x.lastIndex=0,x.test(A))g.push(A);else if(i){const e=i.toLowerCase().split("-")[0];g.push(...v(A,e,h))}else g.push(...z(A,h))}}return g},mt=(t,i={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:h=!1,handleEmoji:g=!1,knownAcronyms:C=[],locale:f,normalize:U=!1,separators:u,stripAnsi:A=!1,stripEmoji:e=!1}=i,a=new Set([...C].toSorted((o,d)=>d.length-o.length));let l=t;A&&(l=ut(l)),e&&(l=V(l));let n;Array.isArray(u)?n=dt(u):u instanceof RegExp?n=u:n=q;const s=[];let r=l;const p=n.flags.includes("g")?n:new RegExp(n.source,`${n.flags}g`);for(;r.length>0;){const o=p.exec(r);if(!o){r===".."?s.push(".."):r==="."?s.push("."):r.length>0&&s.push(r);break}const d=o.index,E=o[0],I=E.length,j=r.slice(0,d),J=r.slice(d+I);if(E.startsWith("../"))s.push(".."),r=r.slice(d+3);else if(E.startsWith("./"))s.push("."),r=r.slice(d+2);else if(d===0&&E==="..")s.push(".."),r=r.slice(2);else if(d===0&&E===".")s.push("."),r=r.slice(1);else{j.length>0&&s.push(j);let L=0;for(;(L=E.indexOf("../",L))!==-1;)s.push(".."),L+=3;for(L=0;(L=E.indexOf("./",L))!==-1;)(L===0||E[L-1]!==".")&&s.push("."),L+=2;let m=J;for(;m.startsWith("../");)s.push(".."),m=m.slice(3);for(;m.startsWith("./");)s.push("."),m=m.slice(2);if(m===".."){s.push("..");break}else if(m==="."){s.push(".");break}else r=m}p.lastIndex=0}if(s.length===0){const o=l.split(n).filter(Boolean);s.push(...o)}let c=[];for(const o of s)h||g?c.push(...Ut(o,f,a)):f?c.push(...v(o,f,a)):c.push(...z(o,a));return U&&(c=c.map(o=>a.has(o)?o:f&&o===o.toLocaleUpperCase(f)?o[0]+o.slice(1).toLocaleLowerCase(f):o.toUpperCase()===o&&!a.has(o)?o.slice(0,1)+o.slice(1).toLowerCase():o)),c};export{mt as splitByCase};
|