@kubb/core 2.1.6 → 2.2.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.
Files changed (55) hide show
  1. package/dist/{chunk-DU6UHGVD.cjs → chunk-2UXXYHS6.cjs} +5 -5
  2. package/dist/{chunk-NWXLHLH3.js → chunk-37XMXECQ.js} +3 -3
  3. package/dist/chunk-5SUBV3F7.cjs +15 -0
  4. package/dist/{chunk-IZOYUU2C.cjs → chunk-CZFLDKR5.cjs} +6 -6
  5. package/dist/{chunk-WHFBT7CJ.cjs → chunk-DM53DOLW.cjs} +90 -90
  6. package/dist/{chunk-QDYI7RBT.js → chunk-ETA3LCRB.js} +3 -3
  7. package/dist/{chunk-QDYI7RBT.js.map → chunk-ETA3LCRB.js.map} +1 -1
  8. package/dist/{chunk-Q4BVTLXG.js → chunk-GKW5TTFV.js} +2 -2
  9. package/dist/{chunk-D42WMZZ7.js → chunk-HI4PB2AG.js} +7 -7
  10. package/dist/{chunk-HGRAENXJ.js → chunk-IQBEGX4Z.js} +2 -2
  11. package/dist/{chunk-DQ3TMDDK.cjs → chunk-JSJ3NRBQ.cjs} +7 -7
  12. package/dist/{chunk-CDC7AOGD.cjs → chunk-KAA3L7N6.cjs} +3 -3
  13. package/dist/{chunk-CDC7AOGD.cjs.map → chunk-KAA3L7N6.cjs.map} +1 -1
  14. package/dist/{chunk-65JU7D5L.cjs → chunk-KXP7HD6Z.cjs} +3 -3
  15. package/dist/{chunk-OCZMQ7SF.js → chunk-MASAFU3G.js} +2 -2
  16. package/dist/{chunk-DAZBGE47.js → chunk-MYC5HIA5.js} +2 -2
  17. package/dist/{chunk-BOAROBF4.cjs → chunk-OI2AOR2F.cjs} +28 -19
  18. package/dist/chunk-OI2AOR2F.cjs.map +1 -0
  19. package/dist/{chunk-6TTDLGHW.cjs → chunk-OYDUQYAK.cjs} +220 -220
  20. package/dist/{chunk-34RQN4Y6.js → chunk-V6AVJEQC.js} +3 -3
  21. package/dist/{chunk-PTGWQCIU.cjs → chunk-XX56SVPB.cjs} +5 -5
  22. package/dist/{chunk-SR5FEIHD.js → chunk-YUTCMBUY.js} +2 -2
  23. package/dist/{chunk-XHS5C5AW.js → chunk-YW33IVCC.js} +2 -2
  24. package/dist/fs.cjs +10 -10
  25. package/dist/fs.js +4 -4
  26. package/dist/index.cjs +102 -102
  27. package/dist/index.js +11 -11
  28. package/dist/logger.cjs +7 -7
  29. package/dist/logger.js +3 -3
  30. package/dist/mocks.cjs +10 -10
  31. package/dist/mocks.js +8 -8
  32. package/dist/transformers.cjs +21 -21
  33. package/dist/transformers.js +5 -5
  34. package/dist/utils.cjs +13 -13
  35. package/dist/utils.js +4 -4
  36. package/package.json +5 -5
  37. package/dist/chunk-BOAROBF4.cjs.map +0 -1
  38. package/dist/chunk-BYGMREPJ.cjs +0 -15
  39. /package/dist/{chunk-DU6UHGVD.cjs.map → chunk-2UXXYHS6.cjs.map} +0 -0
  40. /package/dist/{chunk-IZOYUU2C.cjs.map → chunk-37XMXECQ.js.map} +0 -0
  41. /package/dist/{chunk-BYGMREPJ.cjs.map → chunk-5SUBV3F7.cjs.map} +0 -0
  42. /package/dist/{chunk-NWXLHLH3.js.map → chunk-CZFLDKR5.cjs.map} +0 -0
  43. /package/dist/{chunk-WHFBT7CJ.cjs.map → chunk-DM53DOLW.cjs.map} +0 -0
  44. /package/dist/{chunk-Q4BVTLXG.js.map → chunk-GKW5TTFV.js.map} +0 -0
  45. /package/dist/{chunk-D42WMZZ7.js.map → chunk-HI4PB2AG.js.map} +0 -0
  46. /package/dist/{chunk-HGRAENXJ.js.map → chunk-IQBEGX4Z.js.map} +0 -0
  47. /package/dist/{chunk-34RQN4Y6.js.map → chunk-JSJ3NRBQ.cjs.map} +0 -0
  48. /package/dist/{chunk-65JU7D5L.cjs.map → chunk-KXP7HD6Z.cjs.map} +0 -0
  49. /package/dist/{chunk-OCZMQ7SF.js.map → chunk-MASAFU3G.js.map} +0 -0
  50. /package/dist/{chunk-DAZBGE47.js.map → chunk-MYC5HIA5.js.map} +0 -0
  51. /package/dist/{chunk-6TTDLGHW.cjs.map → chunk-OYDUQYAK.cjs.map} +0 -0
  52. /package/dist/{chunk-DQ3TMDDK.cjs.map → chunk-V6AVJEQC.js.map} +0 -0
  53. /package/dist/{chunk-PTGWQCIU.cjs.map → chunk-XX56SVPB.cjs.map} +0 -0
  54. /package/dist/{chunk-SR5FEIHD.js.map → chunk-YUTCMBUY.js.map} +0 -0
  55. /package/dist/{chunk-XHS5C5AW.js.map → chunk-YW33IVCC.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { init_esm_shims } from './chunk-QDYI7RBT.js';
1
+ import { init_esm_shims } from './chunk-ETA3LCRB.js';
2
2
  import fs from 'fs-extra';
3
3
 
4
4
  // src/fs/clean.ts
@@ -9,4 +9,4 @@ async function clean(path) {
9
9
 
10
10
  export { clean };
11
11
  //# sourceMappingURL=out.js.map
12
- //# sourceMappingURL=chunk-HGRAENXJ.js.map
12
+ //# sourceMappingURL=chunk-IQBEGX4Z.js.map
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkWHFBT7CJ_cjs = require('./chunk-WHFBT7CJ.cjs');
4
- var chunkCDC7AOGD_cjs = require('./chunk-CDC7AOGD.cjs');
3
+ var chunkDM53DOLW_cjs = require('./chunk-DM53DOLW.cjs');
4
+ var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
5
5
  var seedrandom = require('seedrandom');
6
6
  var tty = require('tty');
7
7
 
@@ -10,13 +10,13 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
  var seedrandom__default = /*#__PURE__*/_interopDefault(seedrandom);
11
11
 
12
12
  // src/logger.ts
13
- chunkCDC7AOGD_cjs.init_cjs_shims();
13
+ chunkKAA3L7N6_cjs.init_cjs_shims();
14
14
 
15
15
  // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/node.js
16
- chunkCDC7AOGD_cjs.init_cjs_shims();
16
+ chunkKAA3L7N6_cjs.init_cjs_shims();
17
17
 
18
18
  // ../../node_modules/.pnpm/tinyrainbow@1.1.1/node_modules/tinyrainbow/dist/chunk-5WCZOS7T.js
19
- chunkCDC7AOGD_cjs.init_cjs_shims();
19
+ chunkKAA3L7N6_cjs.init_cjs_shims();
20
20
  var b = {
21
21
  reset: [0, 0],
22
22
  bold: [1, 22, "\x1B[22m\x1B[1m"],
@@ -110,7 +110,7 @@ function createLogger({ logLevel, name, spinner }) {
110
110
  };
111
111
  const debug = async (message) => {
112
112
  if (message) {
113
- await chunkWHFBT7CJ_cjs.writeLog(message);
113
+ await chunkDM53DOLW_cjs.writeLog(message);
114
114
  }
115
115
  };
116
116
  const logger = {
@@ -159,4 +159,4 @@ exports.p = p2;
159
159
  exports.randomCliColour = randomCliColour;
160
160
  exports.randomColour = randomColour;
161
161
  //# sourceMappingURL=out.js.map
162
- //# sourceMappingURL=chunk-DQ3TMDDK.cjs.map
162
+ //# sourceMappingURL=chunk-JSJ3NRBQ.cjs.map
@@ -71,9 +71,9 @@ var __privateMethod = (obj, member, method) => {
71
71
  return method;
72
72
  };
73
73
 
74
- // ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.0_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
74
+ // ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.1_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
75
75
  var init_cjs_shims = __esm({
76
- "../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.0_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
76
+ "../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.1_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
77
77
  }
78
78
  });
79
79
 
@@ -88,4 +88,4 @@ exports.__require = __require;
88
88
  exports.__toESM = __toESM;
89
89
  exports.init_cjs_shims = init_cjs_shims;
90
90
  //# sourceMappingURL=out.js.map
91
- //# sourceMappingURL=chunk-CDC7AOGD.cjs.map
91
+ //# sourceMappingURL=chunk-KAA3L7N6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.0_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL('file:' + __filename).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.39.1_ts-node@10.9.2_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL('file:' + __filename).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkCDC7AOGD_cjs = require('./chunk-CDC7AOGD.cjs');
3
+ var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
4
4
 
5
5
  // src/utils/uniqueName.ts
6
- chunkCDC7AOGD_cjs.init_cjs_shims();
6
+ chunkKAA3L7N6_cjs.init_cjs_shims();
7
7
  function getUniqueName(originalName, data) {
8
8
  let used = data[originalName] || 0;
9
9
  if (used) {
@@ -26,4 +26,4 @@ function setUniqueName(originalName, data) {
26
26
  exports.getUniqueName = getUniqueName;
27
27
  exports.setUniqueName = setUniqueName;
28
28
  //# sourceMappingURL=out.js.map
29
- //# sourceMappingURL=chunk-65JU7D5L.cjs.map
29
+ //# sourceMappingURL=chunk-KXP7HD6Z.cjs.map
@@ -1,4 +1,4 @@
1
- import { init_esm_shims } from './chunk-QDYI7RBT.js';
1
+ import { init_esm_shims } from './chunk-ETA3LCRB.js';
2
2
  import { camelCase as camelCase$1, pascalCase as pascalCase$1 } from 'change-case';
3
3
 
4
4
  // src/transformers/casing.ts
@@ -12,4 +12,4 @@ function pascalCase(text) {
12
12
 
13
13
  export { camelCase, pascalCase };
14
14
  //# sourceMappingURL=out.js.map
15
- //# sourceMappingURL=chunk-OCZMQ7SF.js.map
15
+ //# sourceMappingURL=chunk-MASAFU3G.js.map
@@ -1,4 +1,4 @@
1
- import { init_esm_shims } from './chunk-QDYI7RBT.js';
1
+ import { init_esm_shims } from './chunk-ETA3LCRB.js';
2
2
  import { resolve } from 'path';
3
3
  import fs from 'fs-extra';
4
4
  import { switcher } from 'js-runtime';
@@ -79,4 +79,4 @@ async function writeLog(data) {
79
79
 
80
80
  export { write, writeLog };
81
81
  //# sourceMappingURL=out.js.map
82
- //# sourceMappingURL=chunk-DAZBGE47.js.map
82
+ //# sourceMappingURL=chunk-MYC5HIA5.js.map
@@ -1,25 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkCDC7AOGD_cjs = require('./chunk-CDC7AOGD.cjs');
3
+ var chunkKAA3L7N6_cjs = require('./chunk-KAA3L7N6.cjs');
4
4
 
5
5
  // src/transformers/casing.ts
6
- chunkCDC7AOGD_cjs.init_cjs_shims();
6
+ chunkKAA3L7N6_cjs.init_cjs_shims();
7
7
 
8
- // ../../node_modules/.pnpm/change-case@5.3.0/node_modules/change-case/dist/index.js
9
- chunkCDC7AOGD_cjs.init_cjs_shims();
8
+ // ../../node_modules/.pnpm/change-case@5.4.1/node_modules/change-case/dist/index.js
9
+ chunkKAA3L7N6_cjs.init_cjs_shims();
10
10
  var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
11
11
  var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
12
- var SPLIT_NUMBER_LOWER_RE = /(\d)(\p{Ll})/gu;
13
- var SPLIT_LETTER_NUMBER_RE = /(\p{L})(\d)/gu;
12
+ var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
14
13
  var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
15
14
  var SPLIT_REPLACE_VALUE = "$1\0$2";
16
15
  var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
17
- function split(value, options) {
16
+ function split(value) {
18
17
  let result = value.trim();
19
18
  result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
20
- if (options?.separateNumbers) {
21
- result = result.replace(SPLIT_NUMBER_LOWER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_LETTER_NUMBER_RE, SPLIT_REPLACE_VALUE);
22
- }
23
19
  result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
24
20
  let start = 0;
25
21
  let end = result.length;
@@ -31,23 +27,35 @@ function split(value, options) {
31
27
  end--;
32
28
  return result.slice(start, end).split(/\0/g);
33
29
  }
30
+ function splitSeparateNumbers(value) {
31
+ const words = split(value);
32
+ for (let i = 0; i < words.length; i++) {
33
+ const word = words[i];
34
+ const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
35
+ if (match) {
36
+ const offset = match.index + (match[1] ?? match[2]).length;
37
+ words.splice(i, 1, word.slice(0, offset), word.slice(offset));
38
+ }
39
+ }
40
+ return words;
41
+ }
34
42
  function camelCase(input, options) {
35
- const [prefix, value, suffix] = splitPrefixSuffix(input, options);
43
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
36
44
  const lower = lowerFactory(options?.locale);
37
45
  const upper = upperFactory(options?.locale);
38
46
  const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
39
- return prefix + split(value, options).map((word, index) => {
47
+ return prefix + words.map((word, index) => {
40
48
  if (index === 0)
41
49
  return lower(word);
42
50
  return transform(word, index);
43
51
  }).join(options?.delimiter ?? "") + suffix;
44
52
  }
45
53
  function pascalCase(input, options) {
46
- const [prefix, value, suffix] = splitPrefixSuffix(input, options);
54
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
47
55
  const lower = lowerFactory(options?.locale);
48
56
  const upper = upperFactory(options?.locale);
49
57
  const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
50
- return prefix + split(value, options).map(transform).join(options?.delimiter ?? "") + suffix;
58
+ return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
51
59
  }
52
60
  function lowerFactory(locale) {
53
61
  return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
@@ -65,9 +73,10 @@ function pascalCaseTransformFactory(lower, upper) {
65
73
  return initial + lower(word.slice(1));
66
74
  };
67
75
  }
68
- function splitPrefixSuffix(input, options) {
69
- const prefixCharacters = options?.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
70
- const suffixCharacters = options?.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
76
+ function splitPrefixSuffix(input, options = {}) {
77
+ const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
78
+ const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
79
+ const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
71
80
  let prefixIndex = 0;
72
81
  let suffixIndex = input.length;
73
82
  while (prefixIndex < input.length) {
@@ -85,7 +94,7 @@ function splitPrefixSuffix(input, options) {
85
94
  }
86
95
  return [
87
96
  input.slice(0, prefixIndex),
88
- input.slice(prefixIndex, suffixIndex),
97
+ splitFn(input.slice(prefixIndex, suffixIndex)),
89
98
  input.slice(suffixIndex)
90
99
  ];
91
100
  }
@@ -101,4 +110,4 @@ function pascalCase2(text) {
101
110
  exports.camelCase = camelCase2;
102
111
  exports.pascalCase = pascalCase2;
103
112
  //# sourceMappingURL=out.js.map
104
- //# sourceMappingURL=chunk-BOAROBF4.cjs.map
113
+ //# sourceMappingURL=chunk-OI2AOR2F.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/transformers/casing.ts","../../../node_modules/.pnpm/change-case@5.4.1/node_modules/change-case/src/index.ts"],"names":["camelCase","pascalCase"],"mappings":";;;;;AAAA;;;ACAA;AACA,IAAM,uBAAuB;AAC7B,IAAM,uBAAuB;AAG7B,IAAM,2BAA2B;AAGjC,IAAM,uBAAuB;AAG7B,IAAM,sBAAsB;AAG5B,IAAM,mCAAmC;AA+BnC,SAAU,MAAM,OAAa;AACjC,MAAI,SAAS,MAAM,KAAI;AAEvB,WAAS,OACN,QAAQ,sBAAsB,mBAAmB,EACjD,QAAQ,sBAAsB,mBAAmB;AAEpD,WAAS,OAAO,QAAQ,sBAAsB,IAAI;AAElD,MAAI,QAAQ;AACZ,MAAI,MAAM,OAAO;AAGjB,SAAO,OAAO,OAAO,KAAK,MAAM;AAAM;AACtC,MAAI,UAAU;AAAK,WAAO,CAAA;AAC1B,SAAO,OAAO,OAAO,MAAM,CA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E,WAAW,IAAI,0BAA0B,KAAK,CAAC;AAChF;AAEO,SAASC,YAAW,MAAsB;AAC/C,SAAO,WAAiB,MAAM,EAAE,WAAW,IAAI,0BAA0B,KAAK,CAAC;AACjF","sourcesContent":["import { camelCase as changeCaseCamel, pascalCase as changePascalCase } from 'change-case'\n\nexport function camelCase(text: string): string {\n return changeCaseCamel(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n\nexport function pascalCase(text: string): string {\n return changePascalCase(text, { delimiter: '', mergeAmbiguousCharacters: true })\n}\n","// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(\\d)\\p{Ll}|(\\p{L})\\d/u;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options {\n locale?: Locale;\n split?: (value: string) => string[];\n /** @deprecated Pass `split: splitSeparateNumbers` instead. */\n separateNumbers?: boolean;\n delimiter?: string;\n prefixCharacters?: string;\n suffixCharacters?: string;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value: string) {\n let result = value.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value: string) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n const offset = match.index + (match[1] ?? match[2]).length;\n words.splice(i, 1, word.slice(0, offset), word.slice(offset));\n }\n }\n return words;\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string,\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction splitPrefixSuffix(\n input: string,\n options: Options = {},\n): [string, string[], string] {\n const splitFn =\n options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters =\n options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters =\n options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters.includes(char)) break;\n prefixIndex++;\n }\n\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters.includes(char)) break;\n suffixIndex = index;\n }\n\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n"]}