@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,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const constants = require('../packem_shared/constants-HevSYUjU.cjs');
|
|
4
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
5
|
+
const case_lowerFirst = require('./lower-first.cjs');
|
|
6
|
+
const case_splitByCase = require('./split-by-case.cjs');
|
|
7
|
+
const case_upperFirst = require('./upper-first.cjs');
|
|
8
|
+
const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
|
|
9
|
+
const joinSegments = require('../packem_shared/joinSegments-BH1CT4dK.cjs');
|
|
10
|
+
const normalizeGermanEszett = require('../packem_shared/normalize-german-eszett-DJK0S2qj.cjs');
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
15
|
+
const camelCase = /* @__PURE__ */ __name((value, options) => {
|
|
16
|
+
if (typeof value !== "string" || !value) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
const shouldCache = options?.cache ?? false;
|
|
20
|
+
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
21
|
+
let cacheKey;
|
|
22
|
+
if (shouldCache) {
|
|
23
|
+
cacheKey = generateCacheKey.generateCacheKey(value, options);
|
|
24
|
+
}
|
|
25
|
+
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
26
|
+
return cacheStore.get(cacheKey);
|
|
27
|
+
}
|
|
28
|
+
let firstWord = true;
|
|
29
|
+
const result = joinSegments(
|
|
30
|
+
case_splitByCase.splitByCase(value, {
|
|
31
|
+
handleAnsi: options?.handleAnsi,
|
|
32
|
+
handleEmoji: options?.handleEmoji,
|
|
33
|
+
knownAcronyms: options?.knownAcronyms,
|
|
34
|
+
locale: options?.locale,
|
|
35
|
+
normalize: options?.normalize,
|
|
36
|
+
separators: void 0,
|
|
37
|
+
stripAnsi: options?.stripAnsi,
|
|
38
|
+
stripEmoji: options?.stripEmoji
|
|
39
|
+
}).map((word) => {
|
|
40
|
+
if (options?.handleAnsi && constants.RE_FAST_ANSI.test(word)) {
|
|
41
|
+
return word;
|
|
42
|
+
}
|
|
43
|
+
word = options?.locale?.startsWith("de") ? normalizeGermanEszett.normalizeGermanEszett(word) : word;
|
|
44
|
+
word = options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase();
|
|
45
|
+
if (firstWord) {
|
|
46
|
+
firstWord = false;
|
|
47
|
+
return case_lowerFirst(word, options);
|
|
48
|
+
}
|
|
49
|
+
return case_upperFirst(word, options);
|
|
50
|
+
}),
|
|
51
|
+
""
|
|
52
|
+
);
|
|
53
|
+
if (shouldCache && cacheKey) {
|
|
54
|
+
cacheStore.set(cacheKey, result);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}, "camelCase");
|
|
58
|
+
|
|
59
|
+
module.exports = camelCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, C as CamelCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
declare const camelCase: <T extends string = string>(value?: T, options?: CaseOptions) => CamelCase<T>;
|
|
6
|
+
|
|
7
|
+
export = camelCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, C as CamelCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const camelCase: <T extends string = string>(value?: T, options?: CaseOptions) => CamelCase<T>;
|
|
6
|
+
|
|
7
|
+
export { camelCase as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, C as CamelCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
declare const camelCase: <T extends string = string>(value?: T, options?: CaseOptions) => CamelCase<T>;
|
|
6
|
+
|
|
7
|
+
export = camelCase;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { R as RE_FAST_ANSI } from '../packem_shared/constants-BnVGLrDr.mjs';
|
|
2
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
3
|
+
import lowerFirst from './lower-first.mjs';
|
|
4
|
+
import { splitByCase } from './split-by-case.mjs';
|
|
5
|
+
import upperFirst from './upper-first.mjs';
|
|
6
|
+
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
|
|
7
|
+
import joinSegments from '../packem_shared/joinSegments-BHY8PPnk.mjs';
|
|
8
|
+
import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
13
|
+
const camelCase = /* @__PURE__ */ __name((value, options) => {
|
|
14
|
+
if (typeof value !== "string" || !value) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const shouldCache = options?.cache ?? false;
|
|
18
|
+
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
19
|
+
let cacheKey;
|
|
20
|
+
if (shouldCache) {
|
|
21
|
+
cacheKey = generateCacheKey(value, options);
|
|
22
|
+
}
|
|
23
|
+
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
24
|
+
return cacheStore.get(cacheKey);
|
|
25
|
+
}
|
|
26
|
+
let firstWord = true;
|
|
27
|
+
const result = joinSegments(
|
|
28
|
+
splitByCase(value, {
|
|
29
|
+
handleAnsi: options?.handleAnsi,
|
|
30
|
+
handleEmoji: options?.handleEmoji,
|
|
31
|
+
knownAcronyms: options?.knownAcronyms,
|
|
32
|
+
locale: options?.locale,
|
|
33
|
+
normalize: options?.normalize,
|
|
34
|
+
separators: void 0,
|
|
35
|
+
stripAnsi: options?.stripAnsi,
|
|
36
|
+
stripEmoji: options?.stripEmoji
|
|
37
|
+
}).map((word) => {
|
|
38
|
+
if (options?.handleAnsi && RE_FAST_ANSI.test(word)) {
|
|
39
|
+
return word;
|
|
40
|
+
}
|
|
41
|
+
word = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
|
|
42
|
+
word = options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase();
|
|
43
|
+
if (firstWord) {
|
|
44
|
+
firstWord = false;
|
|
45
|
+
return lowerFirst(word, options);
|
|
46
|
+
}
|
|
47
|
+
return upperFirst(word, options);
|
|
48
|
+
}),
|
|
49
|
+
""
|
|
50
|
+
);
|
|
51
|
+
if (shouldCache && cacheKey) {
|
|
52
|
+
cacheStore.set(cacheKey, result);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}, "camelCase");
|
|
56
|
+
|
|
57
|
+
export { camelCase as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const constants = require('../packem_shared/constants-HevSYUjU.cjs');
|
|
4
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
5
|
+
const case_splitByCase = require('./split-by-case.cjs');
|
|
6
|
+
const case_upperFirst = require('./upper-first.cjs');
|
|
7
|
+
const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
|
|
8
|
+
const joinSegments = require('../packem_shared/joinSegments-BH1CT4dK.cjs');
|
|
9
|
+
const normalizeGermanEszett = require('../packem_shared/normalize-german-eszett-DJK0S2qj.cjs');
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
14
|
+
const capitalCase = /* @__PURE__ */ __name((value, options) => {
|
|
15
|
+
if (typeof value !== "string") {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
const shouldCache = options?.cache ?? false;
|
|
19
|
+
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
20
|
+
let cacheKey;
|
|
21
|
+
if (shouldCache) {
|
|
22
|
+
cacheKey = generateCacheKey.generateCacheKey(value, options);
|
|
23
|
+
}
|
|
24
|
+
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
25
|
+
return cacheStore.get(cacheKey);
|
|
26
|
+
}
|
|
27
|
+
const words = case_splitByCase.splitByCase(value, {
|
|
28
|
+
handleAnsi: options?.handleAnsi,
|
|
29
|
+
handleEmoji: options?.handleEmoji,
|
|
30
|
+
knownAcronyms: options?.knownAcronyms,
|
|
31
|
+
locale: options?.locale,
|
|
32
|
+
normalize: options?.normalize,
|
|
33
|
+
separators: void 0,
|
|
34
|
+
stripAnsi: options?.stripAnsi,
|
|
35
|
+
stripEmoji: options?.stripEmoji
|
|
36
|
+
});
|
|
37
|
+
const processed = words.map((word) => {
|
|
38
|
+
if (constants.RE_FAST_ANSI.test(word)) {
|
|
39
|
+
return word;
|
|
40
|
+
}
|
|
41
|
+
const split = options?.locale?.startsWith("de") ? normalizeGermanEszett.normalizeGermanEszett(word) : word;
|
|
42
|
+
return case_upperFirst(options?.locale ? split.toLocaleLowerCase(options.locale) : split.toLocaleLowerCase(), options);
|
|
43
|
+
});
|
|
44
|
+
const result = joinSegments(processed, " ");
|
|
45
|
+
if (shouldCache && cacheKey) {
|
|
46
|
+
cacheStore.set(cacheKey, result);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}, "capitalCase");
|
|
50
|
+
|
|
51
|
+
module.exports = capitalCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, a as CapitalCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
declare const capitalCase: <T extends string = string>(value?: T, options?: CaseOptions) => CapitalCase<T>;
|
|
6
|
+
|
|
7
|
+
export = capitalCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, a as CapitalCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const capitalCase: <T extends string = string>(value?: T, options?: CaseOptions) => CapitalCase<T>;
|
|
6
|
+
|
|
7
|
+
export { capitalCase as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, a as CapitalCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
declare const capitalCase: <T extends string = string>(value?: T, options?: CaseOptions) => CapitalCase<T>;
|
|
6
|
+
|
|
7
|
+
export = capitalCase;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { R as RE_FAST_ANSI } from '../packem_shared/constants-BnVGLrDr.mjs';
|
|
2
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
3
|
+
import { splitByCase } from './split-by-case.mjs';
|
|
4
|
+
import upperFirst from './upper-first.mjs';
|
|
5
|
+
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
|
|
6
|
+
import joinSegments from '../packem_shared/joinSegments-BHY8PPnk.mjs';
|
|
7
|
+
import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
12
|
+
const capitalCase = /* @__PURE__ */ __name((value, options) => {
|
|
13
|
+
if (typeof value !== "string") {
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
const shouldCache = options?.cache ?? false;
|
|
17
|
+
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
18
|
+
let cacheKey;
|
|
19
|
+
if (shouldCache) {
|
|
20
|
+
cacheKey = generateCacheKey(value, options);
|
|
21
|
+
}
|
|
22
|
+
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
23
|
+
return cacheStore.get(cacheKey);
|
|
24
|
+
}
|
|
25
|
+
const words = splitByCase(value, {
|
|
26
|
+
handleAnsi: options?.handleAnsi,
|
|
27
|
+
handleEmoji: options?.handleEmoji,
|
|
28
|
+
knownAcronyms: options?.knownAcronyms,
|
|
29
|
+
locale: options?.locale,
|
|
30
|
+
normalize: options?.normalize,
|
|
31
|
+
separators: void 0,
|
|
32
|
+
stripAnsi: options?.stripAnsi,
|
|
33
|
+
stripEmoji: options?.stripEmoji
|
|
34
|
+
});
|
|
35
|
+
const processed = words.map((word) => {
|
|
36
|
+
if (RE_FAST_ANSI.test(word)) {
|
|
37
|
+
return word;
|
|
38
|
+
}
|
|
39
|
+
const split = options?.locale?.startsWith("de") ? normalizeGermanEszett(word) : word;
|
|
40
|
+
return upperFirst(options?.locale ? split.toLocaleLowerCase(options.locale) : split.toLocaleLowerCase(), options);
|
|
41
|
+
});
|
|
42
|
+
const result = joinSegments(processed, " ");
|
|
43
|
+
if (shouldCache && cacheKey) {
|
|
44
|
+
cacheStore.set(cacheKey, result);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}, "capitalCase");
|
|
48
|
+
|
|
49
|
+
export { capitalCase as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
4
|
+
const case_kebabCase = require('./kebab-case.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
9
|
+
const constantCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "_", toUpperCase: true }), "constantCase");
|
|
10
|
+
|
|
11
|
+
module.exports = constantCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, c as ConstantCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
declare const constantCase: <T extends string = string>(value?: T, options?: CaseOptions) => ConstantCase<T>;
|
|
6
|
+
|
|
7
|
+
export = constantCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, c as ConstantCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const constantCase: <T extends string = string>(value?: T, options?: CaseOptions) => ConstantCase<T>;
|
|
6
|
+
|
|
7
|
+
export { constantCase as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, c as ConstantCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
declare const constantCase: <T extends string = string>(value?: T, options?: CaseOptions) => ConstantCase<T>;
|
|
6
|
+
|
|
7
|
+
export = constantCase;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
2
|
+
import { kebabCase } from './kebab-case.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
7
|
+
const constantCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "_", toUpperCase: true }), "constantCase");
|
|
8
|
+
|
|
9
|
+
export { constantCase as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
4
|
+
const case_kebabCase = require('./kebab-case.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
9
|
+
const dotCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "." }), "dotCase");
|
|
10
|
+
|
|
11
|
+
module.exports = dotCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, D as DotCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
declare const dotCase: <T extends string = string>(value?: T, options?: CaseOptions) => DotCase<T>;
|
|
6
|
+
|
|
7
|
+
export = dotCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, D as DotCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const dotCase: <T extends string = string>(value?: T, options?: CaseOptions) => DotCase<T>;
|
|
6
|
+
|
|
7
|
+
export { dotCase as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, D as DotCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
declare const dotCase: <T extends string = string>(value?: T, options?: CaseOptions) => DotCase<T>;
|
|
6
|
+
|
|
7
|
+
export = dotCase;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
2
|
+
import { kebabCase } from './kebab-case.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
7
|
+
const dotCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "." }), "dotCase");
|
|
8
|
+
|
|
9
|
+
export { dotCase as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
4
|
+
const case_kebabCase = require('./kebab-case.cjs');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
9
|
+
const flatCase = /* @__PURE__ */ __name((value, options) => case_kebabCase.kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "" }), "flatCase");
|
|
10
|
+
|
|
11
|
+
module.exports = flatCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, F as FlatCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
declare const flatCase: <T extends string = string>(value?: T, options?: CaseOptions) => FlatCase<T>;
|
|
6
|
+
|
|
7
|
+
export = flatCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, F as FlatCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const flatCase: <T extends string = string>(value?: T, options?: CaseOptions) => FlatCase<T>;
|
|
6
|
+
|
|
7
|
+
export { flatCase as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { b as CaseOptions, F as FlatCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
declare const flatCase: <T extends string = string>(value?: T, options?: CaseOptions) => FlatCase<T>;
|
|
6
|
+
|
|
7
|
+
export = flatCase;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
2
|
+
import { kebabCase } from './kebab-case.mjs';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
7
|
+
const flatCase = /* @__PURE__ */ __name((value, options) => kebabCase(value, { cacheStore: defaultCacheStore, ...options, joiner: "" }), "flatCase");
|
|
8
|
+
|
|
9
|
+
export { flatCase as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
|
|
5
|
+
const node_util = require('node:util');
|
|
6
|
+
const constants = require('../packem_shared/constants-HevSYUjU.cjs');
|
|
7
|
+
const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
|
|
8
|
+
const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
13
|
+
const flipCase = /* @__PURE__ */ __name((value, options) => {
|
|
14
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const shouldCache = options?.cache ?? false;
|
|
18
|
+
const cacheStore = options?.cacheStore ?? defaultCacheStore;
|
|
19
|
+
let cacheKey;
|
|
20
|
+
if (shouldCache) {
|
|
21
|
+
cacheKey = generateCacheKey.generateCacheKey(value, options);
|
|
22
|
+
}
|
|
23
|
+
if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
|
|
24
|
+
return cacheStore.get(cacheKey);
|
|
25
|
+
}
|
|
26
|
+
let processedValue = value;
|
|
27
|
+
if (options?.stripEmoji) {
|
|
28
|
+
processedValue = constants.stripEmoji(processedValue);
|
|
29
|
+
}
|
|
30
|
+
if (options?.stripAnsi) {
|
|
31
|
+
processedValue = node_util.stripVTControlCharacters(processedValue);
|
|
32
|
+
}
|
|
33
|
+
let result = "";
|
|
34
|
+
let index = 0;
|
|
35
|
+
while (index < processedValue.length) {
|
|
36
|
+
if (options?.handleAnsi && processedValue[index] === "\x1B") {
|
|
37
|
+
let ansiSequence = processedValue[index];
|
|
38
|
+
index++;
|
|
39
|
+
while (index < processedValue.length && processedValue[index] !== "m") {
|
|
40
|
+
ansiSequence += processedValue[index];
|
|
41
|
+
index++;
|
|
42
|
+
}
|
|
43
|
+
if (index < processedValue.length) {
|
|
44
|
+
ansiSequence += processedValue[index];
|
|
45
|
+
result += ansiSequence;
|
|
46
|
+
}
|
|
47
|
+
index++;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const char = processedValue[index];
|
|
51
|
+
const lowerChar = options?.locale ? char.toLocaleLowerCase(options.locale) : char.toLowerCase();
|
|
52
|
+
result += char === lowerChar ? options?.locale ? char.toLocaleUpperCase(options.locale) : char.toUpperCase() : lowerChar;
|
|
53
|
+
index++;
|
|
54
|
+
}
|
|
55
|
+
if (shouldCache && cacheKey) {
|
|
56
|
+
cacheStore.set(cacheKey, result);
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}, "flipCase");
|
|
60
|
+
|
|
61
|
+
exports.flipCase = flipCase;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b as CaseOptions, d as FlipCase } from '../packem_shared/types-D2-6p7t1.cjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.cjs';
|
|
3
|
+
import '../utils.cjs';
|
|
4
|
+
|
|
5
|
+
type FlipOptions = Omit<CaseOptions, "handleEmoji">;
|
|
6
|
+
declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
|
|
7
|
+
|
|
8
|
+
export { type FlipOptions, flipCase };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b as CaseOptions, d as FlipCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
type FlipOptions = Omit<CaseOptions, "handleEmoji">;
|
|
6
|
+
declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
|
|
7
|
+
|
|
8
|
+
export { type FlipOptions, flipCase };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { b as CaseOptions, d as FlipCase } from '../packem_shared/types-BttWSSIk.js';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.js';
|
|
3
|
+
import '../utils.js';
|
|
4
|
+
|
|
5
|
+
type FlipOptions = Omit<CaseOptions, "handleEmoji">;
|
|
6
|
+
declare const flipCase: <T extends string = string>(value?: T, options?: FlipOptions) => FlipCase<T>;
|
|
7
|
+
|
|
8
|
+
export { type FlipOptions, flipCase };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
+
import { s as stripEmoji } from '../packem_shared/constants-BnVGLrDr.mjs';
|
|
3
|
+
import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
|
|
4
|
+
import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const defaultCacheStore = new LRUCache(1e3);
|
|
9
|
+
const flipCase = /* @__PURE__ */ __name((value, options) => {
|
|
10
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
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
|
+
let processedValue = value;
|
|
23
|
+
if (options?.stripEmoji) {
|
|
24
|
+
processedValue = stripEmoji(processedValue);
|
|
25
|
+
}
|
|
26
|
+
if (options?.stripAnsi) {
|
|
27
|
+
processedValue = stripVTControlCharacters(processedValue);
|
|
28
|
+
}
|
|
29
|
+
let result = "";
|
|
30
|
+
let index = 0;
|
|
31
|
+
while (index < processedValue.length) {
|
|
32
|
+
if (options?.handleAnsi && processedValue[index] === "\x1B") {
|
|
33
|
+
let ansiSequence = processedValue[index];
|
|
34
|
+
index++;
|
|
35
|
+
while (index < processedValue.length && processedValue[index] !== "m") {
|
|
36
|
+
ansiSequence += processedValue[index];
|
|
37
|
+
index++;
|
|
38
|
+
}
|
|
39
|
+
if (index < processedValue.length) {
|
|
40
|
+
ansiSequence += processedValue[index];
|
|
41
|
+
result += ansiSequence;
|
|
42
|
+
}
|
|
43
|
+
index++;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const char = processedValue[index];
|
|
47
|
+
const lowerChar = options?.locale ? char.toLocaleLowerCase(options.locale) : char.toLowerCase();
|
|
48
|
+
result += char === lowerChar ? options?.locale ? char.toLocaleUpperCase(options.locale) : char.toUpperCase() : lowerChar;
|
|
49
|
+
index++;
|
|
50
|
+
}
|
|
51
|
+
if (shouldCache && cacheKey) {
|
|
52
|
+
cacheStore.set(cacheKey, result);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}, "flipCase");
|
|
56
|
+
|
|
57
|
+
export { flipCase };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const identifyCase = /* @__PURE__ */ __name((value) => {
|
|
6
|
+
if (typeof value !== "string" || !value) {
|
|
7
|
+
return "lower";
|
|
8
|
+
}
|
|
9
|
+
if (value === value.toLowerCase()) {
|
|
10
|
+
if (value.includes("_")) {
|
|
11
|
+
return "snake";
|
|
12
|
+
}
|
|
13
|
+
if (value.includes("-")) {
|
|
14
|
+
return "kebab";
|
|
15
|
+
}
|
|
16
|
+
return "lower";
|
|
17
|
+
}
|
|
18
|
+
if (value === value.toUpperCase()) {
|
|
19
|
+
return "upper";
|
|
20
|
+
}
|
|
21
|
+
if (/^[A-Z][a-z0-9]+(?:[A-Z][a-z0-9]+)*$/.test(value)) {
|
|
22
|
+
return "pascal";
|
|
23
|
+
}
|
|
24
|
+
if (/^[a-z0-9]+(?:[A-Z][a-z0-9]+)*$/.test(value)) {
|
|
25
|
+
return "camel";
|
|
26
|
+
}
|
|
27
|
+
return "mixed";
|
|
28
|
+
}, "identifyCase");
|
|
29
|
+
|
|
30
|
+
module.exports = identifyCase;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { I as IdentifyCase } from '../packem_shared/types-BAd3WDHo.mjs';
|
|
2
|
+
import '../packem_shared/types-BNbQJg02.mjs';
|
|
3
|
+
import '../utils.mjs';
|
|
4
|
+
|
|
5
|
+
declare const identifyCase: <T extends string = string>(value?: T) => IdentifyCase<T>;
|
|
6
|
+
|
|
7
|
+
export { identifyCase as default };
|