es-toolkit 1.10.1-dev.229 → 1.10.1-dev.230

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.
@@ -1,10 +1,4 @@
1
1
  import "../chunk-DDH7K4QM.mjs";
2
- import {
3
- unzipWith
4
- } from "../chunk-IFNXROZR.mjs";
5
- import {
6
- without
7
- } from "../chunk-PYEYV7BY.mjs";
8
2
  import {
9
3
  xor
10
4
  } from "../chunk-L7FQX5MN.mjs";
@@ -23,21 +17,12 @@ import {
23
17
  import {
24
18
  zipWith
25
19
  } from "../chunk-4KYXHZ4R.mjs";
26
- import {
27
- toFilled
28
- } from "../chunk-OP4OAKQJ.mjs";
29
- import {
30
- union
31
- } from "../chunk-R6QA7PLZ.mjs";
32
20
  import {
33
21
  unionBy
34
22
  } from "../chunk-NFS7RWWE.mjs";
35
23
  import {
36
24
  unionWith
37
25
  } from "../chunk-2ZCITDMK.mjs";
38
- import {
39
- uniq
40
- } from "../chunk-DVK2N4KC.mjs";
41
26
  import {
42
27
  uniqBy
43
28
  } from "../chunk-OXAZEEGP.mjs";
@@ -48,13 +33,11 @@ import {
48
33
  unzip
49
34
  } from "../chunk-UYZKMBDO.mjs";
50
35
  import {
51
- sample
52
- } from "../chunk-2KNLZB7V.mjs";
36
+ unzipWith
37
+ } from "../chunk-IFNXROZR.mjs";
53
38
  import {
54
- sampleSize
55
- } from "../chunk-EHSKB6DF.mjs";
56
- import "../chunk-GIWAOOFY.mjs";
57
- import "../chunk-SYWMYQYJ.mjs";
39
+ without
40
+ } from "../chunk-PYEYV7BY.mjs";
58
41
  import {
59
42
  shuffle
60
43
  } from "../chunk-G7UQ5PUR.mjs";
@@ -74,11 +57,14 @@ import {
74
57
  takeWhile
75
58
  } from "../chunk-2IXFGSUA.mjs";
76
59
  import {
77
- intersectionBy
78
- } from "../chunk-O6UXZR3U.mjs";
60
+ toFilled
61
+ } from "../chunk-OP4OAKQJ.mjs";
79
62
  import {
80
- intersectionWith
81
- } from "../chunk-XI7KRD2C.mjs";
63
+ union
64
+ } from "../chunk-R6QA7PLZ.mjs";
65
+ import {
66
+ uniq
67
+ } from "../chunk-DVK2N4KC.mjs";
82
68
  import {
83
69
  keyBy
84
70
  } from "../chunk-AJKZMN2V.mjs";
@@ -98,8 +84,13 @@ import {
98
84
  partition
99
85
  } from "../chunk-DN3NOZ3H.mjs";
100
86
  import {
101
- flattenDeep
102
- } from "../chunk-ML727RRJ.mjs";
87
+ sample
88
+ } from "../chunk-2KNLZB7V.mjs";
89
+ import {
90
+ sampleSize
91
+ } from "../chunk-EHSKB6DF.mjs";
92
+ import "../chunk-GIWAOOFY.mjs";
93
+ import "../chunk-SYWMYQYJ.mjs";
103
94
  import {
104
95
  forEachRight
105
96
  } from "../chunk-IEA53J7P.mjs";
@@ -116,11 +107,11 @@ import {
116
107
  intersection
117
108
  } from "../chunk-FVVSE2F2.mjs";
118
109
  import {
119
- differenceBy
120
- } from "../chunk-LVWX5B43.mjs";
110
+ intersectionBy
111
+ } from "../chunk-O6UXZR3U.mjs";
121
112
  import {
122
- differenceWith
123
- } from "../chunk-6NVQAHXP.mjs";
113
+ intersectionWith
114
+ } from "../chunk-XI7KRD2C.mjs";
124
115
  import {
125
116
  drop
126
117
  } from "../chunk-S3CORED5.mjs";
@@ -139,6 +130,9 @@ import {
139
130
  import {
140
131
  flatMap
141
132
  } from "../chunk-KBXHURLW.mjs";
133
+ import {
134
+ flattenDeep
135
+ } from "../chunk-ML727RRJ.mjs";
142
136
  import {
143
137
  flatten
144
138
  } from "../chunk-33MSBDC6.mjs";
@@ -154,6 +148,12 @@ import {
154
148
  import {
155
149
  difference
156
150
  } from "../chunk-JPUKH67K.mjs";
151
+ import {
152
+ differenceBy
153
+ } from "../chunk-LVWX5B43.mjs";
154
+ import {
155
+ differenceWith
156
+ } from "../chunk-6NVQAHXP.mjs";
157
157
  import "../chunk-2MM5EJJX.mjs";
158
158
  export {
159
159
  chunk,
@@ -0,0 +1,25 @@
1
+ import {
2
+ getWords
3
+ } from "./chunk-WVQ7YVRK.mjs";
4
+
5
+ // src/string/startCase.ts
6
+ function startCase(str) {
7
+ const words = getWords(str.trim());
8
+ let result = "";
9
+ for (const word of words) {
10
+ if (result) {
11
+ result += " ";
12
+ }
13
+ if (word === word.toUpperCase()) {
14
+ result += word;
15
+ } else {
16
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+
22
+ export {
23
+ startCase
24
+ };
25
+ //# sourceMappingURL=chunk-MJA7DAOJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/string/startCase.ts"],"sourcesContent":["import { getWords } from './_internal/getWords';\n\n/**\n * Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.\n *\n * Start case is the naming convention in which each word is written with an initial capital letter.\n * @param {string} str - The string to convert.\n * @returns {string} The converted string.\n *\n * @example\n * const result1 = startCase('hello world'); // result will be 'Hello World'\n * const result2 = startCase('HELLO WORLD'); // result will be 'Hello World'\n * const result3 = startCase('hello-world'); // result will be 'Hello World'\n * const result4 = startCase('hello_world'); // result will be 'Hello World'\n */\nexport function startCase(str: string): string {\n const words = getWords(str.trim());\n let result = '';\n for (const word of words) {\n if (result) {\n result += ' ';\n }\n if (word === word.toUpperCase()) {\n result += word;\n } else {\n result += word[0].toUpperCase() + word.slice(1).toLowerCase();\n }\n }\n return result;\n}\n"],"mappings":";;;;;AAeO,SAAS,UAAU,KAAqB;AAC7C,QAAM,QAAQ,SAAS,IAAI,KAAK,CAAC;AACjC,MAAI,SAAS;AACb,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ;AACV,gBAAU;AAAA,IACZ;AACA,QAAI,SAAS,KAAK,YAAY,GAAG;AAC/B,gBAAU;AAAA,IACZ,OAAO;AACL,gBAAU,KAAK,CAAC,EAAE,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,YAAY;AAAA,IAC9D;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-XT74R35S.mjs.map
@@ -80,6 +80,7 @@ export { camelCase } from '../string/camelCase.mjs';
80
80
  export { snakeCase } from '../string/snakeCase.mjs';
81
81
  export { kebabCase } from '../string/kebabCase.mjs';
82
82
  export { lowerCase } from '../string/lowerCase.mjs';
83
+ export { startCase } from '../string/startCase.mjs';
83
84
  export { capitalize } from '../string/capitalize.mjs';
84
85
 
85
86
  /**
@@ -80,6 +80,7 @@ export { camelCase } from '../string/camelCase.js';
80
80
  export { snakeCase } from '../string/snakeCase.js';
81
81
  export { kebabCase } from '../string/kebabCase.js';
82
82
  export { lowerCase } from '../string/lowerCase.js';
83
+ export { startCase } from '../string/startCase.js';
83
84
  export { capitalize } from '../string/capitalize.js';
84
85
 
85
86
  /**
@@ -94,6 +94,7 @@ __export(compat_exports, {
94
94
  sampleSize: () => sampleSize,
95
95
  shuffle: () => shuffle,
96
96
  snakeCase: () => snakeCase,
97
+ startCase: () => startCase,
97
98
  sum: () => sum,
98
99
  sumBy: () => sumBy,
99
100
  tail: () => tail,
@@ -991,6 +992,23 @@ var lowerCase = (str) => {
991
992
  return words.map((word) => word.toLowerCase()).join(" ");
992
993
  };
993
994
 
995
+ // src/string/startCase.ts
996
+ function startCase(str) {
997
+ const words = getWords(str.trim());
998
+ let result = "";
999
+ for (const word of words) {
1000
+ if (result) {
1001
+ result += " ";
1002
+ }
1003
+ if (word === word.toUpperCase()) {
1004
+ result += word;
1005
+ } else {
1006
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
1007
+ }
1008
+ }
1009
+ return result;
1010
+ }
1011
+
994
1012
  // src/compat/array/chunk.ts
995
1013
  function chunk2(arr, size = 1) {
996
1014
  size = Math.max(Math.floor(size), 0);
@@ -1061,6 +1079,7 @@ function chunk2(arr, size = 1) {
1061
1079
  sampleSize,
1062
1080
  shuffle,
1063
1081
  snakeCase,
1082
+ startCase,
1064
1083
  sum,
1065
1084
  sumBy,
1066
1085
  tail,