@visulima/string 3.0.0-alpha.9 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +298 -0
- package/LICENSE.md +68 -3
- package/README.md +80 -2
- package/dist/align-text.d.ts +35 -0
- package/dist/align-text.js +2 -34
- package/dist/case/camel-case.d.ts +17 -3
- package/dist/case/camel-case.js +1 -55
- package/dist/case/capital-case.d.ts +14 -3
- package/dist/case/capital-case.js +1 -47
- package/dist/case/constant-case.d.ts +14 -3
- package/dist/case/constant-case.js +1 -7
- package/dist/case/dot-case.d.ts +14 -3
- package/dist/case/dot-case.js +1 -7
- package/dist/case/flat-case.d.ts +12 -3
- package/dist/case/flat-case.js +1 -7
- package/dist/case/flip-case.d.ts +16 -3
- package/dist/case/flip-case.js +1 -82
- package/dist/case/identify-case.d.ts +15 -3
- package/dist/case/identify-case.js +1 -66
- package/dist/case/index.d.ts +8 -3
- package/dist/case/index.js +1 -20
- package/dist/case/kebab-case.d.ts +25 -3
- package/dist/case/kebab-case.js +1 -55
- package/dist/case/lower-first.d.ts +13 -3
- package/dist/case/lower-first.js +1 -9
- package/dist/case/no-case.d.ts +14 -3
- package/dist/case/no-case.js +1 -7
- package/dist/case/pascal-case.d.ts +17 -3
- package/dist/case/pascal-case.js +1 -48
- package/dist/case/pascal-snake-case.d.ts +14 -3
- package/dist/case/pascal-snake-case.js +1 -28
- package/dist/case/path-case.d.ts +14 -3
- package/dist/case/path-case.js +1 -7
- package/dist/case/sentence-case.d.ts +14 -3
- package/dist/case/sentence-case.js +1 -54
- package/dist/case/snake-case.d.ts +14 -3
- package/dist/case/snake-case.js +1 -7
- package/dist/case/split-by-case.d.ts +29 -3
- package/dist/case/split-by-case.js +1 -763
- package/dist/case/title-case.d.ts +12 -3
- package/dist/case/title-case.js +1 -40
- package/dist/case/train-case.d.ts +14 -3
- package/dist/case/train-case.js +1 -40
- package/dist/case/upper-first.d.ts +13 -3
- package/dist/case/upper-first.js +1 -9
- package/dist/closest-string.d.ts +32 -0
- package/dist/closest-string.js +1 -22
- package/dist/compare-similarity.d.ts +37 -0
- package/dist/compare-similarity.js +1 -12
- package/dist/count-occurrences.d.ts +9 -0
- package/dist/count-occurrences.js +1 -0
- package/dist/direction.d.ts +7 -0
- package/dist/direction.js +1 -0
- package/dist/east-asian-width.d.ts +52 -0
- package/dist/east-asian-width.js +1 -0
- package/dist/excerpt.d.ts +25 -0
- package/dist/excerpt.js +53 -0
- package/dist/get-string-truncated-width.d.ts +151 -0
- package/dist/get-string-truncated-width.js +1 -332
- package/dist/get-string-width.d.ts +58 -0
- package/dist/get-string-width.js +1 -5
- package/dist/indent.d.ts +87 -0
- package/dist/indent.js +1 -0
- package/dist/index.d.ts +12 -20
- package/dist/index.js +1 -44
- package/dist/is-fullwidth-code-point.d.ts +7 -0
- package/dist/is-fullwidth-code-point.js +1 -0
- package/dist/levenshtein.d.ts +25 -0
- package/dist/levenshtein.js +1 -0
- package/dist/native-string-types.d.ts +239 -0
- package/dist/outdent.d.ts +74 -0
- package/dist/outdent.js +1 -109
- package/dist/packem_shared/_isFullWidth-Dqc3MWgl.js +1 -0
- package/dist/packem_shared/closest-C6YDQs4m.js +1 -0
- package/dist/packem_shared/constants-aPzGW29R.js +1 -0
- package/dist/packem_shared/dedent-CPjAYUXh.js +1 -0
- package/dist/packem_shared/eastAsianWidth-DJV8Kqd-.js +1 -0
- package/dist/packem_shared/generate-cache-key-BqU1Cqwm.js +1 -0
- package/dist/packem_shared/indent-cz8WMI0e.js +1 -0
- package/dist/packem_shared/joinSegments-CaHT-45s.js +1 -0
- package/dist/packem_shared/lru-cache-BtMSrYQJ.js +1 -0
- package/dist/packem_shared/normalize-german-eszett-hNMwtGjd.js +1 -0
- package/dist/packem_shared/redent-ByOoJ6fN.js +1 -0
- package/dist/packem_shared/types.d-CmNvyl4l.d.ts +360 -0
- package/dist/packem_shared/types.d-fhe030jX.d.ts +402 -0
- package/dist/replace-string.d.ts +10 -0
- package/dist/replace-string.js +1 -0
- package/dist/slice.d.ts +42 -0
- package/dist/slice.js +1 -415
- package/dist/slugify.d.ts +10 -1
- package/dist/slugify.js +1 -46
- package/dist/test/utils.d.ts +17 -0
- package/dist/test/utils.js +13 -88
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +1 -5
- package/dist/transliterate.d.ts +10 -0
- package/dist/transliterate.js +5 -0
- package/dist/truncate.d.ts +43 -0
- package/dist/truncate.js +1 -112
- package/dist/utilities.d.ts +28 -2
- package/dist/utilities.js +1 -52
- package/dist/word-similarity-sort.d.ts +34 -0
- package/dist/word-similarity-sort.js +1 -22
- package/dist/word-wrap.d.ts +44 -0
- package/dist/word-wrap.js +8 -639
- package/package.json +70 -36
- package/dist/packem_shared/LRUCache-3r3SovvR.js +0 -46
- package/dist/packem_shared/closest-IHuSvnSn.js +0 -139
- package/dist/packem_shared/closestN-DUsjgiXb.js +0 -25
- package/dist/packem_shared/constants-BsZS5f0z.js +0 -95
- package/dist/packem_shared/countOccurrences-CS9XprQN.js +0 -22
- package/dist/packem_shared/direction-C9gfWWTK.js +0 -16
- package/dist/packem_shared/eastAsianWidthType-SD3YniiT.js +0 -20
- package/dist/packem_shared/excerpt-COsVNttN.js +0 -1502
- package/dist/packem_shared/generate-cache-key-DdayDfjV.js +0 -6
- package/dist/packem_shared/indent-D3DSCa6s.js +0 -33
- package/dist/packem_shared/isFullwidthCodePoint-IFXZxNjq.js +0 -10
- package/dist/packem_shared/joinSegments-CvxSgKz0.js +0 -44
- package/dist/packem_shared/lookup-BE8lEqy4.js +0 -104
- package/dist/packem_shared/lru-cache.d-BsP6kbVJ.d.ts +0 -13
- package/dist/packem_shared/normalize-german-eszett-4p3yKEzn.js +0 -8
- package/dist/packem_shared/redent-DSb1IJWn.js +0 -8
- package/dist/packem_shared/replaceString-Ce8X2ZQ-.js +0 -192
- package/dist/packem_shared/stripIndent-D_TRjxZ_.js +0 -20
- package/dist/packem_shared/transliterate-CKt9VK7D.js +0 -47756
- package/dist/packem_shared/types.d-BVNv675q.d.ts +0 -61
- package/dist/packem_shared/types.d-DfgbcNKh.d.ts +0 -57
package/dist/case/camel-case.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import LRUCache from '../packem_shared/LRUCache-3r3SovvR.js';
|
|
3
|
-
import lowerFirst from './lower-first.js';
|
|
4
|
-
import { splitByCase } from './split-by-case.js';
|
|
5
|
-
import upperFirst from './upper-first.js';
|
|
6
|
-
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-DdayDfjV.js';
|
|
7
|
-
import joinSegments from '../packem_shared/joinSegments-CvxSgKz0.js';
|
|
8
|
-
import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-4p3yKEzn.js';
|
|
9
|
-
|
|
10
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
11
|
-
const camelCase = (value, options) => {
|
|
12
|
-
if (typeof value !== "string" || !value) {
|
|
13
|
-
return "";
|
|
14
|
-
}
|
|
15
|
-
const shouldCache = options?.cache ?? false;
|
|
16
|
-
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
17
|
-
let cacheKey;
|
|
18
|
-
if (shouldCache) {
|
|
19
|
-
cacheKey = generateCacheKey(value, options);
|
|
20
|
-
}
|
|
21
|
-
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
22
|
-
return cacheStore.get(cacheKey);
|
|
23
|
-
}
|
|
24
|
-
let firstWord = true;
|
|
25
|
-
const result = joinSegments(
|
|
26
|
-
splitByCase(value, {
|
|
27
|
-
handleAnsi: options?.handleAnsi,
|
|
28
|
-
handleEmoji: options?.handleEmoji,
|
|
29
|
-
knownAcronyms: options?.knownAcronyms,
|
|
30
|
-
locale: options?.locale,
|
|
31
|
-
normalize: options?.normalize,
|
|
32
|
-
separators: void 0,
|
|
33
|
-
stripAnsi: options?.stripAnsi,
|
|
34
|
-
stripEmoji: options?.stripEmoji
|
|
35
|
-
}).map((word) => {
|
|
36
|
-
if (options?.handleAnsi && RE_FAST_ANSI.test(word)) {
|
|
37
|
-
return word;
|
|
38
|
-
}
|
|
39
|
-
const normalized = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
|
|
40
|
-
const lowered = options?.locale ? normalized.toLocaleLowerCase(options.locale) : normalized.toLowerCase();
|
|
41
|
-
if (firstWord) {
|
|
42
|
-
firstWord = false;
|
|
43
|
-
return lowerFirst(lowered, options);
|
|
44
|
-
}
|
|
45
|
-
return upperFirst(lowered, options);
|
|
46
|
-
}),
|
|
47
|
-
""
|
|
48
|
-
);
|
|
49
|
-
if (shouldCache && cacheKey) {
|
|
50
|
-
cacheStore.set(cacheKey, result);
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export { camelCase as default };
|
|
1
|
+
import{c}from"../packem_shared/constants-aPzGW29R.js";import{i as p}from"../packem_shared/lru-cache-BtMSrYQJ.js";import f from"./lower-first.js";import{splitByCase as A}from"./split-by-case.js";import h from"./upper-first.js";import{n as d}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import u from"../packem_shared/joinSegments-CaHT-45s.js";import{a as w}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const y=new p(1e3),_=(t,o)=>{if(typeof t!="string"||!t)return"";const i=o?.cache??!1,n=o?.cacheStore??y;let r;if(i&&(r=d(t,o)),i&&r&&n.has(r))return n.get(r);let a=!0;const e=u(A(t,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(s=>{if(o?.handleAnsi&&c.test(s))return s;const m=o?.locale?.startsWith("de")?w(s):s,l=o?.locale?m.toLocaleLowerCase(o.locale):m.toLowerCase();return a?(a=!1,f(l,o)):h(l,o)}),"");return i&&r&&n.set(r,e),e};export{_ as default};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, a as CapitalCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to Capital Case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* capitalCase("foo bar") // => "Foo Bar"
|
|
8
|
+
* capitalCase("foo-bar") // => "Foo Bar"
|
|
9
|
+
* capitalCase("foo_bar") // => "Foo Bar"
|
|
10
|
+
* capitalCase("XMLHttpRequest") // => "Xml Http Request"
|
|
11
|
+
* capitalCase("AJAXRequest") // => "Ajax Request"
|
|
12
|
+
* capitalCase("QueryXML123String") // => "Query Xml 123 String"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
declare const capitalCase: <T extends string = string>(value?: T, options?: CaseOptions) => CapitalCase<T>;
|
|
5
16
|
export { capitalCase as default };
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import LRUCache from '../packem_shared/LRUCache-3r3SovvR.js';
|
|
3
|
-
import { splitByCase } from './split-by-case.js';
|
|
4
|
-
import upperFirst from './upper-first.js';
|
|
5
|
-
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-DdayDfjV.js';
|
|
6
|
-
import joinSegments from '../packem_shared/joinSegments-CvxSgKz0.js';
|
|
7
|
-
import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-4p3yKEzn.js';
|
|
8
|
-
|
|
9
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
10
|
-
const capitalCase = (value, options) => {
|
|
11
|
-
if (typeof value !== "string") {
|
|
12
|
-
return "";
|
|
13
|
-
}
|
|
14
|
-
const shouldCache = options?.cache ?? false;
|
|
15
|
-
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
16
|
-
let cacheKey;
|
|
17
|
-
if (shouldCache) {
|
|
18
|
-
cacheKey = generateCacheKey(value, options);
|
|
19
|
-
}
|
|
20
|
-
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
21
|
-
return cacheStore.get(cacheKey);
|
|
22
|
-
}
|
|
23
|
-
const words = splitByCase(value, {
|
|
24
|
-
handleAnsi: options?.handleAnsi,
|
|
25
|
-
handleEmoji: options?.handleEmoji,
|
|
26
|
-
knownAcronyms: options?.knownAcronyms,
|
|
27
|
-
locale: options?.locale,
|
|
28
|
-
normalize: options?.normalize,
|
|
29
|
-
separators: void 0,
|
|
30
|
-
stripAnsi: options?.stripAnsi,
|
|
31
|
-
stripEmoji: options?.stripEmoji
|
|
32
|
-
});
|
|
33
|
-
const processed = words.map((word) => {
|
|
34
|
-
if (RE_FAST_ANSI.test(word)) {
|
|
35
|
-
return word;
|
|
36
|
-
}
|
|
37
|
-
const split = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
|
|
38
|
-
return upperFirst(options?.locale ? split.toLocaleLowerCase(options.locale) : split.toLocaleLowerCase(), options);
|
|
39
|
-
});
|
|
40
|
-
const result = joinSegments(processed, " ");
|
|
41
|
-
if (shouldCache && cacheKey) {
|
|
42
|
-
cacheStore.set(cacheKey, result);
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { capitalCase as default };
|
|
1
|
+
import{c as m}from"../packem_shared/constants-aPzGW29R.js";import{i as c}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{splitByCase as p}from"./split-by-case.js";import f from"./upper-first.js";import{n as h}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import A from"../packem_shared/joinSegments-CaHT-45s.js";import{a as d}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const u=new c(1e3),S=(s,o)=>{if(typeof s!="string")return"";const i=o?.cache??!1,a=o?.cacheStore??u;let r;if(i&&(r=h(s,o)),i&&r&&a.has(r))return a.get(r);const l=p(s,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(m.test(t))return t;const e=o?.locale?.startsWith("de")?d(t):t;return f(o?.locale?e.toLocaleLowerCase(o.locale):e.toLocaleLowerCase(),o)}),n=A(l," ");return i&&r&&a.set(r,n),n};export{S as default};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, c as ConstantCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to CONSTANT_CASE.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* constantCase("foo bar") // => "FOO_BAR"
|
|
8
|
+
* constantCase("foo-bar") // => "FOO_BAR"
|
|
9
|
+
* constantCase("foo_bar") // => "FOO_BAR"
|
|
10
|
+
* constantCase("XMLHttpRequest") // => "XML_HTTP_REQUEST"
|
|
11
|
+
* constantCase("AJAXRequest") // => "AJAX_REQUEST"
|
|
12
|
+
* constantCase("QueryXML123String") // => "QUERY_XML_123_STRING"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
declare const constantCase: <T extends string = string>(value?: T, options?: CaseOptions) => ConstantCase<T>;
|
|
5
16
|
export { constantCase as default };
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { kebabCase } from './kebab-case.js';
|
|
3
|
-
|
|
4
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
5
|
-
const constantCase = (value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "_", toUpperCase: true });
|
|
6
|
-
|
|
7
|
-
export { constantCase as default };
|
|
1
|
+
import{i as r}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),m=(e,o)=>t(e,{cacheStore:a,...o,joiner:"_",toUpperCase:!0});export{m as default};
|
package/dist/case/dot-case.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, D as DotCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to dot.case.
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* dotCase("foo bar") // => "foo.bar"
|
|
8
|
+
* dotCase("foo-bar") // => "foo.bar"
|
|
9
|
+
* dotCase("foo_bar") // => "foo.bar"
|
|
10
|
+
* dotCase("XMLHttpRequest") // => "xml.http.request"
|
|
11
|
+
* dotCase("AJAXRequest") // => "ajax.request"
|
|
12
|
+
* dotCase("QueryXML123String") // => "query.xml.123.string"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
declare const dotCase: <T extends string = string>(value?: T, options?: CaseOptions) => DotCase<T>;
|
|
5
16
|
export { dotCase as default };
|
package/dist/case/dot-case.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { kebabCase } from './kebab-case.js';
|
|
3
|
-
|
|
4
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
5
|
-
const dotCase = (value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "." });
|
|
6
|
-
|
|
7
|
-
export { dotCase as default };
|
|
1
|
+
import{i as r}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{kebabCase as a}from"./kebab-case.js";const t=new r(1e3),c=(e,o)=>a(e,{cacheStore:t,...o,joiner:"."});export{c as default};
|
package/dist/case/flat-case.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, F as FlatCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a string to flat case (all lowercase, no separators).
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* flatCase("foo-barBaz") // => "foobarbaz"
|
|
8
|
+
* flatCase("XMLHttpRequest") // => "xmlhttprequest"
|
|
9
|
+
* flatCase("AJAXRequest") // => "ajaxrequest"
|
|
10
|
+
* flatCase("QueryXML123String") // => "queryxml123string"
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
4
13
|
declare const flatCase: <T extends string = string>(value?: T, options?: CaseOptions) => FlatCase<T>;
|
|
5
14
|
export { flatCase as default };
|
package/dist/case/flat-case.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { kebabCase } from './kebab-case.js';
|
|
3
|
-
|
|
4
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
5
|
-
const flatCase = (value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "" });
|
|
6
|
-
|
|
7
|
-
export { flatCase as default };
|
|
1
|
+
import{i as r}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),c=(e,o)=>t(e,{cacheStore:a,...o,joiner:""});export{c as default};
|
package/dist/case/flip-case.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, d as FlipCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
3
|
+
/**
|
|
4
|
+
* Options specific to flip case operations.
|
|
5
|
+
* Note: handleEmoji is not needed as the function preserves emojis by default
|
|
6
|
+
*/
|
|
4
7
|
type FlipOptions = Omit<CaseOptions, "handleEmoji">;
|
|
8
|
+
/**
|
|
9
|
+
* Flips the case of each character in a string.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* flipCase("FooBar") // => "fOObAR"
|
|
13
|
+
* flipCase("foobar") // => "FOOBAR"
|
|
14
|
+
* flipCase("FOOBAR") // => "foobar"
|
|
15
|
+
* flipCase("XMLHttpRequest") // => "xmlhTTPrEQUEST"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
5
18
|
declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
|
|
6
19
|
export { FlipOptions, flipCase };
|
package/dist/case/flip-case.js
CHANGED
|
@@ -1,82 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
4
|
-
|
|
5
|
-
const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
|
|
6
|
-
|
|
7
|
-
const __cjs_getBuiltinModule = (module) => {
|
|
8
|
-
// Check if we're in Node.js and version supports getBuiltinModule
|
|
9
|
-
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
10
|
-
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
11
|
-
// Node.js 20.16.0+ and 22.3.0+
|
|
12
|
-
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
13
|
-
return __cjs_getProcess.getBuiltinModule(module);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Fallback to createRequire
|
|
17
|
-
return __cjs_require(module);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
stripVTControlCharacters
|
|
22
|
-
} = __cjs_getBuiltinModule("node:util");
|
|
23
|
-
import { s as stripEmoji } from '../packem_shared/constants-BsZS5f0z.js';
|
|
24
|
-
import LRUCache from '../packem_shared/LRUCache-3r3SovvR.js';
|
|
25
|
-
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-DdayDfjV.js';
|
|
26
|
-
|
|
27
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
28
|
-
const flipCase = (value, options) => {
|
|
29
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
30
|
-
return "";
|
|
31
|
-
}
|
|
32
|
-
const shouldCache = options?.cache ?? false;
|
|
33
|
-
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
34
|
-
let cacheKey;
|
|
35
|
-
if (shouldCache) {
|
|
36
|
-
cacheKey = generateCacheKey(value, options);
|
|
37
|
-
}
|
|
38
|
-
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
39
|
-
return cacheStore.get(cacheKey);
|
|
40
|
-
}
|
|
41
|
-
let processedValue = value;
|
|
42
|
-
if (options?.stripEmoji) {
|
|
43
|
-
processedValue = stripEmoji(processedValue);
|
|
44
|
-
}
|
|
45
|
-
if (options?.stripAnsi) {
|
|
46
|
-
processedValue = stripVTControlCharacters(processedValue);
|
|
47
|
-
}
|
|
48
|
-
let result = "";
|
|
49
|
-
let index = 0;
|
|
50
|
-
while (index < processedValue.length) {
|
|
51
|
-
if (options?.handleAnsi && processedValue[index] === "\x1B") {
|
|
52
|
-
let ansiSequence = processedValue[index];
|
|
53
|
-
index += 1;
|
|
54
|
-
while (index < processedValue.length && processedValue[index] !== "m") {
|
|
55
|
-
ansiSequence += processedValue[index];
|
|
56
|
-
index += 1;
|
|
57
|
-
}
|
|
58
|
-
if (index < processedValue.length) {
|
|
59
|
-
ansiSequence += processedValue[index];
|
|
60
|
-
result += ansiSequence;
|
|
61
|
-
}
|
|
62
|
-
index += 1;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
const char = processedValue[index];
|
|
66
|
-
const lowerChar = options?.locale ? char.toLocaleLowerCase(options.locale) : char.toLowerCase();
|
|
67
|
-
let flippedChar;
|
|
68
|
-
if (char === lowerChar) {
|
|
69
|
-
flippedChar = options?.locale ? char.toLocaleUpperCase(options.locale) : char.toUpperCase();
|
|
70
|
-
} else {
|
|
71
|
-
flippedChar = lowerChar;
|
|
72
|
-
}
|
|
73
|
-
result += flippedChar;
|
|
74
|
-
index += 1;
|
|
75
|
-
}
|
|
76
|
-
if (shouldCache && cacheKey) {
|
|
77
|
-
cacheStore.set(cacheKey, result);
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export { flipCase };
|
|
1
|
+
import{createRequire as m}from"node:module";import{s as _}from"../packem_shared/constants-aPzGW29R.js";import{i as j}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{n as C}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";const h=m(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=s=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,n]=l.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return l.getBuiltinModule(s)}return h(s)},{stripVTControlCharacters:g}=d("node:util"),b=new j(1e3),v=(s,e)=>{if(typeof s!="string"||s.length===0)return"";const n=e?.cache??!1,a=e?.cacheStore??b;let r;if(n&&(r=C(s,e)),n&&r&&a.has(r))return a.get(r);let o=s;e?.stripEmoji&&(o=_(o)),e?.stripAnsi&&(o=g(o));let c="",t=0;for(;t<o.length;){if(e?.handleAnsi&&o[t]==="\x1B"){let f=o[t];for(t+=1;t<o.length&&o[t]!=="m";)f+=o[t],t+=1;t<o.length&&(f+=o[t],c+=f),t+=1;continue}const i=o[t],u=e?.locale?i.toLocaleLowerCase(e.locale):i.toLowerCase();let p;i===u?p=e?.locale?i.toLocaleUpperCase(e.locale):i.toUpperCase():p=u,c+=p,t+=1}return n&&r&&a.set(r,c),c};export{v as flipCase};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import { I as IdentifyCase } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { I as IdentifyCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
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
16
|
declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
|
|
5
17
|
export { identifyCase as default };
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
const CONTAINS_LETTER_CASE_INSENSITIVE = /[a-z]/i;
|
|
3
|
-
const IS_UPPER_SNAKE_CASE = /^[A-Z0-9_]+$/;
|
|
4
|
-
const IS_LOWER_SNAKE_CASE = /^[a-z0-9_]+$/;
|
|
5
|
-
const IS_KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
6
|
-
const IS_LOWERCASE_WITH_SPACE = /^[a-z ]+$/;
|
|
7
|
-
const IS_UPPERCASE = /^[A-Z][A-Z0-9]*$/;
|
|
8
|
-
const WHITESPACE_REGEX = /\s+/;
|
|
9
|
-
const IS_NUMERIC = /^\d+$/;
|
|
10
|
-
const IS_CAMEL_CASE_LIKE = /^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/;
|
|
11
|
-
const IS_LOWERCASE_START = /^[a-z]/;
|
|
12
|
-
const CONTAINS_PUNCTUATION_MID_WORD = /[.!?;:,](?!\s|$)/;
|
|
13
|
-
const identifyCase = (value) => {
|
|
14
|
-
if (typeof value !== "string") {
|
|
15
|
-
throw new TypeError("Expected input to be a string");
|
|
16
|
-
}
|
|
17
|
-
if (!value) {
|
|
18
|
-
return "unknown";
|
|
19
|
-
}
|
|
20
|
-
if (!CONTAINS_LETTER_CASE_INSENSITIVE.test(value)) {
|
|
21
|
-
return "unknown";
|
|
22
|
-
}
|
|
23
|
-
if (value.includes("_")) {
|
|
24
|
-
if (IS_UPPER_SNAKE_CASE.test(value)) {
|
|
25
|
-
return "upper_snake";
|
|
26
|
-
}
|
|
27
|
-
if (IS_LOWER_SNAKE_CASE.test(value)) {
|
|
28
|
-
return "snake";
|
|
29
|
-
}
|
|
30
|
-
return "mixed";
|
|
31
|
-
}
|
|
32
|
-
if (value.includes("-")) {
|
|
33
|
-
if (IS_KEBAB_CASE.test(value)) {
|
|
34
|
-
return "kebab";
|
|
35
|
-
}
|
|
36
|
-
return "mixed";
|
|
37
|
-
}
|
|
38
|
-
if (IS_LOWERCASE_WITH_SPACE.test(value)) {
|
|
39
|
-
return "lower";
|
|
40
|
-
}
|
|
41
|
-
if (IS_UPPERCASE.test(value)) {
|
|
42
|
-
return "upper";
|
|
43
|
-
}
|
|
44
|
-
const words = value.split(WHITESPACE_REGEX);
|
|
45
|
-
if (words.length > 1 && words.every((word) => IS_PASCAL_CASE.test(word))) {
|
|
46
|
-
return "title";
|
|
47
|
-
}
|
|
48
|
-
if (words.length > 1 && IS_NUMERIC.test(words[0]) && IS_PASCAL_CASE.test(words[1])) {
|
|
49
|
-
return "title";
|
|
50
|
-
}
|
|
51
|
-
if (words.length > 1 && IS_PASCAL_CASE.test(words[0]) && IS_LOWERCASE_START.test(words[1])) {
|
|
52
|
-
return "sentence";
|
|
53
|
-
}
|
|
54
|
-
if (IS_PASCAL_CASE.test(value)) {
|
|
55
|
-
return "pascal";
|
|
56
|
-
}
|
|
57
|
-
if (IS_CAMEL_CASE_LIKE.test(value)) {
|
|
58
|
-
return "camel";
|
|
59
|
-
}
|
|
60
|
-
if (CONTAINS_PUNCTUATION_MID_WORD.test(value)) {
|
|
61
|
-
return "unknown";
|
|
62
|
-
}
|
|
63
|
-
return "mixed";
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { identifyCase as default };
|
|
1
|
+
const n=/^([A-Z][a-z]*)+$/,r=/[a-z]/i,a=/^[A-Z0-9_]+$/,i=/^[a-z0-9_]+$/,u=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,l=/^[a-z ]+$/,o=/^[A-Z][A-Z0-9]*$/,p=/\s+/,z=/^\d+$/,c=/^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/,f=/^[a-z]/,$=/[.!?;:,](?!\s|$)/,d=e=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(!e||!r.test(e))return"unknown";if(e.includes("_"))return a.test(e)?"upper_snake":i.test(e)?"snake":"mixed";if(e.includes("-"))return u.test(e)?"kebab":"mixed";if(l.test(e))return"lower";if(o.test(e))return"upper";const t=e.split(p);return t.length>1&&t.every(s=>n.test(s))||t.length>1&&z.test(t[0])&&n.test(t[1])?"title":t.length>1&&n.test(t[0])&&f.test(t[1])?"sentence":n.test(e)?"pascal":c.test(e)?"camel":$.test(e)?"unknown":"mixed"};export{d as default};
|
package/dist/case/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { N as NodeLocale } from "../packem_shared/types.d-CmNvyl4l.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,8 +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 {
|
|
20
|
+
export type { C as CamelCase, a as CapitalCase, b as CaseOptions, c as ConstantCase, D as DotCase, F as FlatCase, d as FlipCase, I as IdentifyCase, K as KebabCase, L as LocaleOptions, e as LowerFirst, N as NoCase, P as PascalCase, f as PascalSnakeCase, g as PathCase, S as SentenceCase, h as SnakeCase, i as SplitByCase, T as TitleCase, j as TrainCase, U as UpperFirst } from "../packem_shared/types.d-fhe030jX.js";
|
|
21
21
|
export { default as upperFirst } from "./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
28
|
declare const joinSegments: (segments: string[], joiner: string) => string;
|
|
24
29
|
export { joinSegments };
|
package/dist/case/index.js
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { default as capitalCase } from './capital-case.js';
|
|
3
|
-
export { default as constantCase } from './constant-case.js';
|
|
4
|
-
export { default as dotCase } from './dot-case.js';
|
|
5
|
-
export { default as flatCase } from './flat-case.js';
|
|
6
|
-
export { flipCase } from './flip-case.js';
|
|
7
|
-
export { default as identifyCase } from './identify-case.js';
|
|
8
|
-
export { kebabCase } from './kebab-case.js';
|
|
9
|
-
export { default as lowerFirst } from './lower-first.js';
|
|
10
|
-
export { default as noCase } from './no-case.js';
|
|
11
|
-
export { default as pascalCase } from './pascal-case.js';
|
|
12
|
-
export { default as pascalSnakeCase } from './pascal-snake-case.js';
|
|
13
|
-
export { default as pathCase } from './path-case.js';
|
|
14
|
-
export { default as sentenceCase } from './sentence-case.js';
|
|
15
|
-
export { default as snakeCase } from './snake-case.js';
|
|
16
|
-
export { splitByCase } from './split-by-case.js';
|
|
17
|
-
export { default as titleCase } from './title-case.js';
|
|
18
|
-
export { default as trainCase } from './train-case.js';
|
|
19
|
-
export { default as upperFirst } from './upper-first.js';
|
|
20
|
-
export { default as joinSegments } from '../packem_shared/joinSegments-CvxSgKz0.js';
|
|
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-CaHT-45s.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,9 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
import "../packem_shared/lru-cache.d-BsP6kbVJ.js";
|
|
1
|
+
import { b as CaseOptions, K as KebabCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
4
3
|
interface KebabCaseOptions extends CaseOptions {
|
|
4
|
+
/**
|
|
5
|
+
* String used to join words together in kebab case format.
|
|
6
|
+
* @default "-"
|
|
7
|
+
*/
|
|
5
8
|
joiner?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether to convert the result to uppercase.
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
6
13
|
toUpperCase?: boolean;
|
|
7
14
|
}
|
|
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
|
+
*/
|
|
8
30
|
declare const kebabCase: <T extends string = string>(value?: T, options?: KebabCaseOptions) => KebabCase<T>;
|
|
9
31
|
export { KebabCaseOptions, kebabCase };
|
package/dist/case/kebab-case.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import LRUCache from '../packem_shared/LRUCache-3r3SovvR.js';
|
|
3
|
-
import { splitByCase } from './split-by-case.js';
|
|
4
|
-
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-DdayDfjV.js';
|
|
5
|
-
import joinSegments from '../packem_shared/joinSegments-CvxSgKz0.js';
|
|
6
|
-
import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-4p3yKEzn.js';
|
|
7
|
-
|
|
8
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
9
|
-
const kebabCase = (value, options) => {
|
|
10
|
-
if (typeof value !== "string") {
|
|
11
|
-
return "";
|
|
12
|
-
}
|
|
13
|
-
const shouldCache = options?.cache ?? false;
|
|
14
|
-
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
15
|
-
let cacheKey;
|
|
16
|
-
if (shouldCache) {
|
|
17
|
-
cacheKey = generateCacheKey(value, options);
|
|
18
|
-
}
|
|
19
|
-
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
20
|
-
return cacheStore.get(cacheKey);
|
|
21
|
-
}
|
|
22
|
-
const words = splitByCase(value, {
|
|
23
|
-
handleAnsi: options?.handleAnsi,
|
|
24
|
-
handleEmoji: options?.handleEmoji,
|
|
25
|
-
knownAcronyms: options?.knownAcronyms,
|
|
26
|
-
locale: options?.locale,
|
|
27
|
-
normalize: options?.normalize,
|
|
28
|
-
separators: void 0,
|
|
29
|
-
stripAnsi: options?.stripAnsi,
|
|
30
|
-
stripEmoji: options?.stripEmoji
|
|
31
|
-
});
|
|
32
|
-
const processed = words.map((word) => {
|
|
33
|
-
if (options?.handleAnsi && RE_FAST_ANSI.test(word)) {
|
|
34
|
-
return word;
|
|
35
|
-
}
|
|
36
|
-
if (options?.toUpperCase) {
|
|
37
|
-
if (options.locale) {
|
|
38
|
-
return word.toLocaleUpperCase(options.locale);
|
|
39
|
-
}
|
|
40
|
-
return word.toUpperCase();
|
|
41
|
-
}
|
|
42
|
-
const split = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
|
|
43
|
-
if (options?.locale) {
|
|
44
|
-
return split.toLocaleLowerCase(options.locale);
|
|
45
|
-
}
|
|
46
|
-
return split.toLowerCase();
|
|
47
|
-
});
|
|
48
|
-
const result = joinSegments(processed, options?.joiner ?? "-");
|
|
49
|
-
if (shouldCache && cacheKey) {
|
|
50
|
-
cacheStore.set(cacheKey, result);
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export { kebabCase };
|
|
1
|
+
import{c}from"../packem_shared/constants-aPzGW29R.js";import{i as m}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{splitByCase as p}from"./split-by-case.js";import{n as f}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import h from"../packem_shared/joinSegments-CaHT-45s.js";import{a as A}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const d=new m(1e3),L=(s,o)=>{if(typeof s!="string")return"";const n=o?.cache??!1,e=o?.cacheStore??d;let r;if(n&&(r=f(s,o)),n&&r&&e.has(r))return e.get(r);const l=p(s,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(o?.handleAnsi&&c.test(t))return t;if(o?.toUpperCase)return o.locale?t.toLocaleUpperCase(o.locale):t.toUpperCase();const a=o?.locale?.startsWith("de")?A(t):t;return o?.locale?a.toLocaleLowerCase(o.locale):a.toLowerCase()}),i=h(l,o?.joiner??"-");return n&&r&&e.set(r,i),i};export{L as kebabCase};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { L as LocaleOptions, e as LowerFirst } from "../packem_shared/types.d-
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { L as LocaleOptions, e as LowerFirst } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
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
14
|
declare const lowerFirst: <T extends string = string>(value?: T, options?: LocaleOptions) => LowerFirst<T>;
|
|
5
15
|
export { lowerFirst as default };
|
package/dist/case/lower-first.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (typeof value !== "string" || value === "") {
|
|
3
|
-
return "";
|
|
4
|
-
}
|
|
5
|
-
const firstChar = options?.locale ? value[0].toLocaleLowerCase(options.locale) : value[0].toLowerCase();
|
|
6
|
-
return firstChar + value.slice(1);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export { lowerFirst as default };
|
|
1
|
+
const a=(e,o)=>typeof e!="string"||e===""?"":(o?.locale?e[0].toLocaleLowerCase(o.locale):e[0].toLowerCase())+e.slice(1);export{a as default};
|
package/dist/case/no-case.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../packem_shared/types.d-
|
|
3
|
-
|
|
1
|
+
import { b as CaseOptions, N as NoCase } from "../packem_shared/types.d-fhe030jX.js";
|
|
2
|
+
import "../packem_shared/types.d-CmNvyl4l.js";
|
|
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
15
|
declare const noCase: <T extends string = string>(value?: T, options?: CaseOptions) => NoCase<T>;
|
|
5
16
|
export { noCase as default };
|
package/dist/case/no-case.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { kebabCase } from './kebab-case.js';
|
|
3
|
-
|
|
4
|
-
const defaultCacheStore = new LRUCache(1e3);
|
|
5
|
-
const noCase = (value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: " " });
|
|
6
|
-
|
|
7
|
-
export { noCase as default };
|
|
1
|
+
import{i as r}from"../packem_shared/lru-cache-BtMSrYQJ.js";import{kebabCase as a}from"./kebab-case.js";const t=new r(1e3),c=(e,o)=>a(e,{cacheStore:t,...o,joiner:" "});export{c as default};
|