@dathomir/shared 0.0.1-beta.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/LICENSE.md ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
package/dist/index.cjs ADDED
@@ -0,0 +1,112 @@
1
+
2
+ //#region src/utils/entries.ts
3
+ const entries = (obj) => {
4
+ return Object.entries(obj);
5
+ };
6
+
7
+ //#endregion
8
+ //#region src/utils/fromEntries.ts
9
+ const fromEntries = (entries$1) => {
10
+ return entries$1.reduce((acc, cur) => {
11
+ return {
12
+ ...acc,
13
+ [cur[0]]: cur[1]
14
+ };
15
+ }, {});
16
+ };
17
+
18
+ //#endregion
19
+ //#region src/utils/scule.ts
20
+ const NUMBER_CHAR_RE = /\d/;
21
+ const STR_SPLITTERS = [
22
+ "-",
23
+ "_",
24
+ "/",
25
+ "."
26
+ ];
27
+ function isUppercase(char = "") {
28
+ if (NUMBER_CHAR_RE.test(char)) return;
29
+ return char !== char.toLowerCase();
30
+ }
31
+ function splitByCase(str, separators) {
32
+ const splitters = separators ?? STR_SPLITTERS;
33
+ const parts = [];
34
+ if (!str || typeof str !== "string") return parts;
35
+ let buff = "";
36
+ let previousUpper;
37
+ let previousSplitter;
38
+ for (const char of str) {
39
+ const isSplitter = splitters.includes(char);
40
+ if (isSplitter === true) {
41
+ parts.push(buff);
42
+ buff = "";
43
+ previousUpper = void 0;
44
+ continue;
45
+ }
46
+ const isUpper = isUppercase(char);
47
+ if (previousSplitter === false) {
48
+ if (previousUpper === false && isUpper === true) {
49
+ parts.push(buff);
50
+ buff = char;
51
+ previousUpper = isUpper;
52
+ continue;
53
+ }
54
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
55
+ const lastChar = buff.at(-1);
56
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
57
+ buff = lastChar + char;
58
+ previousUpper = isUpper;
59
+ continue;
60
+ }
61
+ }
62
+ buff += char;
63
+ previousUpper = isUpper;
64
+ previousSplitter = isSplitter;
65
+ }
66
+ parts.push(buff);
67
+ return parts;
68
+ }
69
+ function upperFirst(str) {
70
+ return str ? str[0].toUpperCase() + str.slice(1) : "";
71
+ }
72
+ function lowerFirst(str) {
73
+ return str ? str[0].toLowerCase() + str.slice(1) : "";
74
+ }
75
+ function pascalCase(str, opts) {
76
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
77
+ }
78
+ function camelCase(str, opts) {
79
+ return lowerFirst(pascalCase(str || "", opts));
80
+ }
81
+ function kebabCase(str, joiner) {
82
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
83
+ }
84
+ function snakeCase(str) {
85
+ return kebabCase(str || "", "_");
86
+ }
87
+ function flatCase(str) {
88
+ return kebabCase(str || "", "");
89
+ }
90
+ function trainCase(str, opts) {
91
+ return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
92
+ }
93
+ const titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
94
+ function titleCase(str, opts) {
95
+ return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)).join(" ");
96
+ }
97
+
98
+ //#endregion
99
+ exports.camelCase = camelCase;
100
+ exports.entries = entries;
101
+ exports.flatCase = flatCase;
102
+ exports.fromEntries = fromEntries;
103
+ exports.isUppercase = isUppercase;
104
+ exports.kebabCase = kebabCase;
105
+ exports.lowerFirst = lowerFirst;
106
+ exports.pascalCase = pascalCase;
107
+ exports.snakeCase = snakeCase;
108
+ exports.splitByCase = splitByCase;
109
+ exports.titleCase = titleCase;
110
+ exports.trainCase = trainCase;
111
+ exports.upperFirst = upperFirst;
112
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["entries","parts: string[]","previousUpper: boolean | undefined","previousSplitter: boolean | undefined"],"sources":["../src/utils/entries.ts","../src/utils/fromEntries.ts","../src/utils/scule.ts"],"sourcesContent":["type Entries<T> = (keyof T extends infer U\n ? U extends keyof T\n ? [U, T[U]]\n : never\n : never)[];\n\nconst entries = <T extends Record<string, unknown>>(obj: T): Entries<T> => {\n return Object.entries(obj) as Entries<T>;\n};\n\nexport { entries };\nexport type { Entries };\n","type FromEntries<T extends [PropertyKey, unknown][]> = {\n [K in T[number][0]]: Extract<T[number], [K, unknown]>[1];\n};\n\nconst fromEntries = <T extends [PropertyKey, unknown][]>(\n entries: T\n): FromEntries<T> => {\n return entries.reduce((acc, cur) => {\n return {\n ...acc,\n [cur[0]]: cur[1],\n };\n }, {} as FromEntries<T>);\n};\n\nexport { fromEntries };\nexport type { FromEntries };\n","type Splitter = \"-\" | \"_\" | \"/\" | \".\";\ntype FirstOfString<S extends string> = S extends `${infer F}${string}`\n ? F\n : never;\ntype RemoveFirstOfString<S extends string> = S extends `${string}${infer R}`\n ? R\n : never;\ntype IsUpper<S extends string> = S extends Uppercase<S> ? true : false;\ntype IsLower<S extends string> = S extends Lowercase<S> ? true : false;\ntype SameLetterCase<\n X extends string,\n Y extends string\n> = IsUpper<X> extends IsUpper<Y>\n ? true\n : IsLower<X> extends IsLower<Y>\n ? true\n : false;\ntype CapitalizedWords<\n T extends readonly string[],\n Accumulator extends string = \"\",\n Normalize extends boolean | undefined = false\n> = T extends readonly [infer F extends string, ...infer R extends string[]]\n ? CapitalizedWords<\n R,\n `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`,\n Normalize\n >\n : Accumulator;\ntype JoinLowercaseWords<\n T extends readonly string[],\n Joiner extends string,\n Accumulator extends string = \"\"\n> = T extends readonly [infer F extends string, ...infer R extends string[]]\n ? Accumulator extends \"\"\n ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`>\n : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`>\n : Accumulator;\n\ntype LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;\ntype RemoveLastOfArray<T extends any[]> = T extends [...infer F, any]\n ? F\n : never;\n\nexport type CaseOptions = {\n normalize?: boolean;\n};\n\nexport type SplitByCase<\n T,\n Separator extends string = Splitter,\n Accumulator extends unknown[] = []\n> = string extends Separator\n ? string[]\n : T extends `${infer F}${infer R}`\n ? [LastOfArray<Accumulator>] extends [never]\n ? SplitByCase<R, Separator, [F]>\n : LastOfArray<Accumulator> extends string\n ? R extends \"\"\n ? SplitByCase<\n R,\n Separator,\n [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]\n >\n : SameLetterCase<F, FirstOfString<R>> extends true\n ? F extends Separator\n ? FirstOfString<R> extends Separator\n ? SplitByCase<R, Separator, [...Accumulator, \"\"]>\n : IsUpper<FirstOfString<R>> extends true\n ? SplitByCase<\n RemoveFirstOfString<R>,\n Separator,\n [...Accumulator, FirstOfString<R>]\n >\n : SplitByCase<R, Separator, [...Accumulator, \"\"]>\n : SplitByCase<\n R,\n Separator,\n [\n ...RemoveLastOfArray<Accumulator>,\n `${LastOfArray<Accumulator>}${F}`\n ]\n >\n : IsLower<F> extends true\n ? SplitByCase<\n RemoveFirstOfString<R>,\n Separator,\n [\n ...RemoveLastOfArray<Accumulator>,\n `${LastOfArray<Accumulator>}${F}`,\n FirstOfString<R>\n ]\n >\n : SplitByCase<R, Separator, [...Accumulator, F]>\n : never\n : Accumulator extends []\n ? T extends \"\"\n ? []\n : string[]\n : Accumulator;\n\nexport type JoinByCase<T, Joiner extends string> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? JoinLowercaseWords<SplitByCase<T>, Joiner>\n : never\n : T extends readonly string[]\n ? JoinLowercaseWords<T, Joiner>\n : never;\n\nexport type PascalCase<\n T,\n Normalize extends boolean | undefined = false\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? CapitalizedWords<SplitByCase<T>, \"\", Normalize>\n : never\n : T extends readonly string[]\n ? CapitalizedWords<T, \"\", Normalize>\n : never;\n\nexport type CamelCase<\n T,\n Normalize extends boolean | undefined = false\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : Uncapitalize<PascalCase<T, Normalize>>;\n\nexport type KebabCase<\n T extends string | readonly string[],\n Joiner extends string = \"-\"\n> = JoinByCase<T, Joiner>;\n\nexport type SnakeCase<T extends string | readonly string[]> = JoinByCase<\n T,\n \"_\"\n>;\n\nexport type TrainCase<\n T,\n Normalize extends boolean | undefined = false,\n Joiner extends string = \"-\"\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? CapitalizedWords<SplitByCase<T>, Joiner>\n : never\n : T extends readonly string[]\n ? CapitalizedWords<T, Joiner, Normalize>\n : never;\n\nexport type FlatCase<\n T extends string | readonly string[],\n Joiner extends string = \"\"\n> = JoinByCase<T, Joiner>;\n\nconst NUMBER_CHAR_RE = /\\d/;\nconst STR_SPLITTERS = [\"-\", \"_\", \"/\", \".\"] as const;\n\nexport function isUppercase(char = \"\"): boolean | undefined {\n if (NUMBER_CHAR_RE.test(char)) {\n return undefined;\n }\n return char !== char.toLowerCase();\n}\n\nexport function splitByCase<T extends string>(str: T): SplitByCase<T>;\nexport function splitByCase<\n T extends string,\n Separator extends readonly string[]\n>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;\nexport function splitByCase<\n T extends string,\n Separator extends readonly string[]\n>(str: T, separators?: Separator) {\n const splitters = separators ?? STR_SPLITTERS;\n const parts: string[] = [];\n\n if (!str || typeof str !== \"string\") {\n return parts as SplitByCase<T, Separator[number]>;\n }\n\n let buff = \"\";\n\n let previousUpper: boolean | undefined;\n let previousSplitter: boolean | undefined;\n\n for (const char of str) {\n // Splitter\n const isSplitter = (splitters as unknown as string).includes(char);\n if (isSplitter === true) {\n parts.push(buff);\n buff = \"\";\n previousUpper = undefined;\n continue;\n }\n\n const isUpper = isUppercase(char);\n if (previousSplitter === false) {\n // Case rising edge\n if (previousUpper === false && isUpper === true) {\n parts.push(buff);\n buff = char;\n previousUpper = isUpper;\n continue;\n }\n // Case falling edge\n if (previousUpper === true && isUpper === false && buff.length > 1) {\n const lastChar = buff.at(-1);\n parts.push(buff.slice(0, Math.max(0, buff.length - 1)));\n buff = lastChar + char;\n previousUpper = isUpper;\n continue;\n }\n }\n\n // Normal char\n buff += char;\n previousUpper = isUpper;\n previousSplitter = isSplitter;\n }\n\n parts.push(buff);\n\n return parts as SplitByCase<T, Separator[number]>;\n}\n\nexport function upperFirst<S extends string>(str: S): Capitalize<S> {\n return (str ? str[0].toUpperCase() + str.slice(1) : \"\") as Capitalize<S>;\n}\n\nexport function lowerFirst<S extends string>(str: S): Uncapitalize<S> {\n return (str ? str[0].toLowerCase() + str.slice(1) : \"\") as Uncapitalize<S>;\n}\n\nexport function pascalCase(): \"\";\nexport function pascalCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions[\"normalize\"]>;\nexport function pascalCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return str\n ? ((Array.isArray(str) ? str : splitByCase(str as string))\n .map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p))\n .join(\"\") as PascalCase<T, UserCaseOptions[\"normalize\"]>)\n : \"\";\n}\n\nexport function camelCase(): \"\";\nexport function camelCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions[\"normalize\"]>;\nexport function camelCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return lowerFirst(pascalCase(str || \"\", opts)) as CamelCase<\n T,\n UserCaseOptions[\"normalize\"]\n >;\n}\n\nexport function kebabCase(): \"\";\nexport function kebabCase<T extends string | readonly string[]>(\n str: T\n): KebabCase<T>;\nexport function kebabCase<\n T extends string | readonly string[],\n Joiner extends string\n>(str: T, joiner: Joiner): KebabCase<T, Joiner>;\nexport function kebabCase<\n T extends string | readonly string[],\n Joiner extends string\n>(str?: T, joiner?: Joiner) {\n return str\n ? ((Array.isArray(str) ? str : splitByCase(str as string))\n .map((p) => p.toLowerCase())\n .join(joiner ?? \"-\") as KebabCase<T, Joiner>)\n : \"\";\n}\n\nexport function snakeCase(): \"\";\nexport function snakeCase<T extends string | readonly string[]>(\n str: T\n): SnakeCase<T>;\nexport function snakeCase<T extends string | readonly string[]>(str?: T) {\n return kebabCase(str || \"\", \"_\") as SnakeCase<T>;\n}\n\nexport function flatCase(): \"\";\nexport function flatCase<T extends string | readonly string[]>(\n str: T\n): FlatCase<T>;\nexport function flatCase<T extends string | readonly string[]>(str?: T) {\n return kebabCase(str || \"\", \"\") as FlatCase<T>;\n}\n\nexport function trainCase(): \"\";\nexport function trainCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions[\"normalize\"]>;\nexport function trainCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return (Array.isArray(str) ? str : splitByCase(str as string))\n .filter(Boolean)\n .map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p))\n .join(\"-\") as TrainCase<T, UserCaseOptions[\"normalize\"]>;\n}\n\nconst titleCaseExceptions =\n /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;\n\nexport function titleCase(): \"\";\nexport function titleCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(\n str: T,\n opts?: UserCaseOptions\n): TrainCase<T, UserCaseOptions[\"normalize\"], \" \">;\nexport function titleCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return (Array.isArray(str) ? str : splitByCase(str as string))\n .filter(Boolean)\n .map((p) =>\n titleCaseExceptions.test(p)\n ? p.toLowerCase()\n : upperFirst(opts?.normalize ? p.toLowerCase() : p)\n )\n .join(\" \") as TrainCase<T, UserCaseOptions[\"normalize\"]>;\n}\n"],"mappings":";;AAMA,MAAM,WAA8C,QAAuB;AACzE,QAAO,OAAO,QAAQ,IAAI;;;;;ACH5B,MAAM,eACJ,cACmB;AACnB,QAAOA,UAAQ,QAAQ,KAAK,QAAQ;AAClC,SAAO;GACL,GAAG;IACF,IAAI,KAAK,IAAI;GACf;IACA,EAAE,CAAmB;;;;;AC2J1B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;CAAC;CAAK;CAAK;CAAK;CAAI;AAE1C,SAAgB,YAAY,OAAO,IAAyB;AAC1D,KAAI,eAAe,KAAK,KAAK,CAC3B;AAEF,QAAO,SAAS,KAAK,aAAa;;AAQpC,SAAgB,YAGd,KAAQ,YAAwB;CAChC,MAAM,YAAY,cAAc;CAChC,MAAMC,QAAkB,EAAE;AAE1B,KAAI,CAAC,OAAO,OAAO,QAAQ,SACzB,QAAO;CAGT,IAAI,OAAO;CAEX,IAAIC;CACJ,IAAIC;AAEJ,MAAK,MAAM,QAAQ,KAAK;EAEtB,MAAM,aAAc,UAAgC,SAAS,KAAK;AAClE,MAAI,eAAe,MAAM;AACvB,SAAM,KAAK,KAAK;AAChB,UAAO;AACP,mBAAgB;AAChB;;EAGF,MAAM,UAAU,YAAY,KAAK;AACjC,MAAI,qBAAqB,OAAO;AAE9B,OAAI,kBAAkB,SAAS,YAAY,MAAM;AAC/C,UAAM,KAAK,KAAK;AAChB,WAAO;AACP,oBAAgB;AAChB;;AAGF,OAAI,kBAAkB,QAAQ,YAAY,SAAS,KAAK,SAAS,GAAG;IAClE,MAAM,WAAW,KAAK,GAAG,GAAG;AAC5B,UAAM,KAAK,KAAK,MAAM,GAAG,KAAK,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC,CAAC;AACvD,WAAO,WAAW;AAClB,oBAAgB;AAChB;;;AAKJ,UAAQ;AACR,kBAAgB;AAChB,qBAAmB;;AAGrB,OAAM,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,WAA6B,KAAuB;AAClE,QAAQ,MAAM,IAAI,GAAG,aAAa,GAAG,IAAI,MAAM,EAAE,GAAG;;AAGtD,SAAgB,WAA6B,KAAyB;AACpE,QAAQ,MAAM,IAAI,GAAG,aAAa,GAAG,IAAI,MAAM,EAAE,GAAG;;AAQtD,SAAgB,WAGd,KAAS,MAAwB;AACjC,QAAO,OACD,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EACpD,KAAK,MAAM,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CAAC,CAC7D,KAAK,GAAG,GACX;;AAQN,SAAgB,UAGd,KAAS,MAAwB;AACjC,QAAO,WAAW,WAAW,OAAO,IAAI,KAAK,CAAC;;AAchD,SAAgB,UAGd,KAAS,QAAiB;AAC1B,QAAO,OACD,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EACpD,KAAK,MAAM,EAAE,aAAa,CAAC,CAC3B,KAAK,UAAU,IAAI,GACtB;;AAON,SAAgB,UAAgD,KAAS;AACvE,QAAO,UAAU,OAAO,IAAI,IAAI;;AAOlC,SAAgB,SAA+C,KAAS;AACtE,QAAO,UAAU,OAAO,IAAI,GAAG;;AAQjC,SAAgB,UAGd,KAAS,MAAwB;AACjC,SAAQ,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EAC1D,OAAO,QAAQ,CACf,KAAK,MAAM,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CAAC,CAC7D,KAAK,IAAI;;AAGd,MAAM,sBACJ;AAUF,SAAgB,UAGd,KAAS,MAAwB;AACjC,SAAQ,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EAC1D,OAAO,QAAQ,CACf,KAAK,MACJ,oBAAoB,KAAK,EAAE,GACvB,EAAE,aAAa,GACf,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CACtD,CACA,KAAK,IAAI"}
@@ -0,0 +1,53 @@
1
+ //#region src/utils/entries.d.ts
2
+ type Entries<T> = (keyof T extends infer U ? U extends keyof T ? [U, T[U]] : never : never)[];
3
+ declare const entries: <T extends Record<string, unknown>>(obj: T) => Entries<T>;
4
+ //#endregion
5
+ //#region src/utils/fromEntries.d.ts
6
+ type FromEntries<T extends [PropertyKey, unknown][]> = { [K in T[number][0]]: Extract<T[number], [K, unknown]>[1] };
7
+ declare const fromEntries: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<T>;
8
+ //#endregion
9
+ //#region src/utils/scule.d.ts
10
+ type Splitter = "-" | "_" | "/" | ".";
11
+ type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
12
+ type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
13
+ type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
14
+ type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
15
+ type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
16
+ type CapitalizedWords<T extends readonly string[], Accumulator extends string = "", Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
17
+ type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ""> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends "" ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
18
+ type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
19
+ type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
20
+ type CaseOptions = {
21
+ normalize?: boolean;
22
+ };
23
+ type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...Accumulator, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
24
+ type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
25
+ type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, "", Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, "", Normalize> : never;
26
+ type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
27
+ type KebabCase<T extends string | readonly string[], Joiner extends string = "-"> = JoinByCase<T, Joiner>;
28
+ type SnakeCase<T extends string | readonly string[]> = JoinByCase<T, "_">;
29
+ type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = "-"> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
30
+ type FlatCase<T extends string | readonly string[], Joiner extends string = ""> = JoinByCase<T, Joiner>;
31
+ declare function isUppercase(char?: string): boolean | undefined;
32
+ declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
33
+ declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
34
+ declare function upperFirst<S extends string>(str: S): Capitalize<S>;
35
+ declare function lowerFirst<S extends string>(str: S): Uncapitalize<S>;
36
+ declare function pascalCase(): "";
37
+ declare function pascalCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions["normalize"]>;
38
+ declare function camelCase(): "";
39
+ declare function camelCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions["normalize"]>;
40
+ declare function kebabCase(): "";
41
+ declare function kebabCase<T extends string | readonly string[]>(str: T): KebabCase<T>;
42
+ declare function kebabCase<T extends string | readonly string[], Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
43
+ declare function snakeCase(): "";
44
+ declare function snakeCase<T extends string | readonly string[]>(str: T): SnakeCase<T>;
45
+ declare function flatCase(): "";
46
+ declare function flatCase<T extends string | readonly string[]>(str: T): FlatCase<T>;
47
+ declare function trainCase(): "";
48
+ declare function trainCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"]>;
49
+ declare function titleCase(): "";
50
+ declare function titleCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"], " ">;
51
+ //#endregion
52
+ export { CamelCase, CaseOptions, type Entries, FlatCase, type FromEntries, JoinByCase, KebabCase, PascalCase, SnakeCase, SplitByCase, TrainCase, camelCase, entries, flatCase, fromEntries, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
53
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1,53 @@
1
+ //#region src/utils/entries.d.ts
2
+ type Entries<T> = (keyof T extends infer U ? U extends keyof T ? [U, T[U]] : never : never)[];
3
+ declare const entries: <T extends Record<string, unknown>>(obj: T) => Entries<T>;
4
+ //#endregion
5
+ //#region src/utils/fromEntries.d.ts
6
+ type FromEntries<T extends [PropertyKey, unknown][]> = { [K in T[number][0]]: Extract<T[number], [K, unknown]>[1] };
7
+ declare const fromEntries: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<T>;
8
+ //#endregion
9
+ //#region src/utils/scule.d.ts
10
+ type Splitter = "-" | "_" | "/" | ".";
11
+ type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
12
+ type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
13
+ type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
14
+ type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
15
+ type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
16
+ type CapitalizedWords<T extends readonly string[], Accumulator extends string = "", Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
17
+ type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ""> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends "" ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
18
+ type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
19
+ type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
20
+ type CaseOptions = {
21
+ normalize?: boolean;
22
+ };
23
+ type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...Accumulator, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`, FirstOfString<R>]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
24
+ type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
25
+ type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, "", Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, "", Normalize> : never;
26
+ type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
27
+ type KebabCase<T extends string | readonly string[], Joiner extends string = "-"> = JoinByCase<T, Joiner>;
28
+ type SnakeCase<T extends string | readonly string[]> = JoinByCase<T, "_">;
29
+ type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = "-"> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
30
+ type FlatCase<T extends string | readonly string[], Joiner extends string = ""> = JoinByCase<T, Joiner>;
31
+ declare function isUppercase(char?: string): boolean | undefined;
32
+ declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
33
+ declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
34
+ declare function upperFirst<S extends string>(str: S): Capitalize<S>;
35
+ declare function lowerFirst<S extends string>(str: S): Uncapitalize<S>;
36
+ declare function pascalCase(): "";
37
+ declare function pascalCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions["normalize"]>;
38
+ declare function camelCase(): "";
39
+ declare function camelCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions["normalize"]>;
40
+ declare function kebabCase(): "";
41
+ declare function kebabCase<T extends string | readonly string[]>(str: T): KebabCase<T>;
42
+ declare function kebabCase<T extends string | readonly string[], Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
43
+ declare function snakeCase(): "";
44
+ declare function snakeCase<T extends string | readonly string[]>(str: T): SnakeCase<T>;
45
+ declare function flatCase(): "";
46
+ declare function flatCase<T extends string | readonly string[]>(str: T): FlatCase<T>;
47
+ declare function trainCase(): "";
48
+ declare function trainCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"]>;
49
+ declare function titleCase(): "";
50
+ declare function titleCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"], " ">;
51
+ //#endregion
52
+ export { CamelCase, CaseOptions, type Entries, FlatCase, type FromEntries, JoinByCase, KebabCase, PascalCase, SnakeCase, SplitByCase, TrainCase, camelCase, entries, flatCase, fromEntries, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
53
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,99 @@
1
+ //#region src/utils/entries.ts
2
+ const entries = (obj) => {
3
+ return Object.entries(obj);
4
+ };
5
+
6
+ //#endregion
7
+ //#region src/utils/fromEntries.ts
8
+ const fromEntries = (entries$1) => {
9
+ return entries$1.reduce((acc, cur) => {
10
+ return {
11
+ ...acc,
12
+ [cur[0]]: cur[1]
13
+ };
14
+ }, {});
15
+ };
16
+
17
+ //#endregion
18
+ //#region src/utils/scule.ts
19
+ const NUMBER_CHAR_RE = /\d/;
20
+ const STR_SPLITTERS = [
21
+ "-",
22
+ "_",
23
+ "/",
24
+ "."
25
+ ];
26
+ function isUppercase(char = "") {
27
+ if (NUMBER_CHAR_RE.test(char)) return;
28
+ return char !== char.toLowerCase();
29
+ }
30
+ function splitByCase(str, separators) {
31
+ const splitters = separators ?? STR_SPLITTERS;
32
+ const parts = [];
33
+ if (!str || typeof str !== "string") return parts;
34
+ let buff = "";
35
+ let previousUpper;
36
+ let previousSplitter;
37
+ for (const char of str) {
38
+ const isSplitter = splitters.includes(char);
39
+ if (isSplitter === true) {
40
+ parts.push(buff);
41
+ buff = "";
42
+ previousUpper = void 0;
43
+ continue;
44
+ }
45
+ const isUpper = isUppercase(char);
46
+ if (previousSplitter === false) {
47
+ if (previousUpper === false && isUpper === true) {
48
+ parts.push(buff);
49
+ buff = char;
50
+ previousUpper = isUpper;
51
+ continue;
52
+ }
53
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
54
+ const lastChar = buff.at(-1);
55
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
56
+ buff = lastChar + char;
57
+ previousUpper = isUpper;
58
+ continue;
59
+ }
60
+ }
61
+ buff += char;
62
+ previousUpper = isUpper;
63
+ previousSplitter = isSplitter;
64
+ }
65
+ parts.push(buff);
66
+ return parts;
67
+ }
68
+ function upperFirst(str) {
69
+ return str ? str[0].toUpperCase() + str.slice(1) : "";
70
+ }
71
+ function lowerFirst(str) {
72
+ return str ? str[0].toLowerCase() + str.slice(1) : "";
73
+ }
74
+ function pascalCase(str, opts) {
75
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
76
+ }
77
+ function camelCase(str, opts) {
78
+ return lowerFirst(pascalCase(str || "", opts));
79
+ }
80
+ function kebabCase(str, joiner) {
81
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
82
+ }
83
+ function snakeCase(str) {
84
+ return kebabCase(str || "", "_");
85
+ }
86
+ function flatCase(str) {
87
+ return kebabCase(str || "", "");
88
+ }
89
+ function trainCase(str, opts) {
90
+ return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
91
+ }
92
+ const titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
93
+ function titleCase(str, opts) {
94
+ return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)).join(" ");
95
+ }
96
+
97
+ //#endregion
98
+ export { camelCase, entries, flatCase, fromEntries, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
99
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["entries","parts: string[]","previousUpper: boolean | undefined","previousSplitter: boolean | undefined"],"sources":["../src/utils/entries.ts","../src/utils/fromEntries.ts","../src/utils/scule.ts"],"sourcesContent":["type Entries<T> = (keyof T extends infer U\n ? U extends keyof T\n ? [U, T[U]]\n : never\n : never)[];\n\nconst entries = <T extends Record<string, unknown>>(obj: T): Entries<T> => {\n return Object.entries(obj) as Entries<T>;\n};\n\nexport { entries };\nexport type { Entries };\n","type FromEntries<T extends [PropertyKey, unknown][]> = {\n [K in T[number][0]]: Extract<T[number], [K, unknown]>[1];\n};\n\nconst fromEntries = <T extends [PropertyKey, unknown][]>(\n entries: T\n): FromEntries<T> => {\n return entries.reduce((acc, cur) => {\n return {\n ...acc,\n [cur[0]]: cur[1],\n };\n }, {} as FromEntries<T>);\n};\n\nexport { fromEntries };\nexport type { FromEntries };\n","type Splitter = \"-\" | \"_\" | \"/\" | \".\";\ntype FirstOfString<S extends string> = S extends `${infer F}${string}`\n ? F\n : never;\ntype RemoveFirstOfString<S extends string> = S extends `${string}${infer R}`\n ? R\n : never;\ntype IsUpper<S extends string> = S extends Uppercase<S> ? true : false;\ntype IsLower<S extends string> = S extends Lowercase<S> ? true : false;\ntype SameLetterCase<\n X extends string,\n Y extends string\n> = IsUpper<X> extends IsUpper<Y>\n ? true\n : IsLower<X> extends IsLower<Y>\n ? true\n : false;\ntype CapitalizedWords<\n T extends readonly string[],\n Accumulator extends string = \"\",\n Normalize extends boolean | undefined = false\n> = T extends readonly [infer F extends string, ...infer R extends string[]]\n ? CapitalizedWords<\n R,\n `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`,\n Normalize\n >\n : Accumulator;\ntype JoinLowercaseWords<\n T extends readonly string[],\n Joiner extends string,\n Accumulator extends string = \"\"\n> = T extends readonly [infer F extends string, ...infer R extends string[]]\n ? Accumulator extends \"\"\n ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`>\n : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`>\n : Accumulator;\n\ntype LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;\ntype RemoveLastOfArray<T extends any[]> = T extends [...infer F, any]\n ? F\n : never;\n\nexport type CaseOptions = {\n normalize?: boolean;\n};\n\nexport type SplitByCase<\n T,\n Separator extends string = Splitter,\n Accumulator extends unknown[] = []\n> = string extends Separator\n ? string[]\n : T extends `${infer F}${infer R}`\n ? [LastOfArray<Accumulator>] extends [never]\n ? SplitByCase<R, Separator, [F]>\n : LastOfArray<Accumulator> extends string\n ? R extends \"\"\n ? SplitByCase<\n R,\n Separator,\n [...RemoveLastOfArray<Accumulator>, `${LastOfArray<Accumulator>}${F}`]\n >\n : SameLetterCase<F, FirstOfString<R>> extends true\n ? F extends Separator\n ? FirstOfString<R> extends Separator\n ? SplitByCase<R, Separator, [...Accumulator, \"\"]>\n : IsUpper<FirstOfString<R>> extends true\n ? SplitByCase<\n RemoveFirstOfString<R>,\n Separator,\n [...Accumulator, FirstOfString<R>]\n >\n : SplitByCase<R, Separator, [...Accumulator, \"\"]>\n : SplitByCase<\n R,\n Separator,\n [\n ...RemoveLastOfArray<Accumulator>,\n `${LastOfArray<Accumulator>}${F}`\n ]\n >\n : IsLower<F> extends true\n ? SplitByCase<\n RemoveFirstOfString<R>,\n Separator,\n [\n ...RemoveLastOfArray<Accumulator>,\n `${LastOfArray<Accumulator>}${F}`,\n FirstOfString<R>\n ]\n >\n : SplitByCase<R, Separator, [...Accumulator, F]>\n : never\n : Accumulator extends []\n ? T extends \"\"\n ? []\n : string[]\n : Accumulator;\n\nexport type JoinByCase<T, Joiner extends string> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? JoinLowercaseWords<SplitByCase<T>, Joiner>\n : never\n : T extends readonly string[]\n ? JoinLowercaseWords<T, Joiner>\n : never;\n\nexport type PascalCase<\n T,\n Normalize extends boolean | undefined = false\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? CapitalizedWords<SplitByCase<T>, \"\", Normalize>\n : never\n : T extends readonly string[]\n ? CapitalizedWords<T, \"\", Normalize>\n : never;\n\nexport type CamelCase<\n T,\n Normalize extends boolean | undefined = false\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : Uncapitalize<PascalCase<T, Normalize>>;\n\nexport type KebabCase<\n T extends string | readonly string[],\n Joiner extends string = \"-\"\n> = JoinByCase<T, Joiner>;\n\nexport type SnakeCase<T extends string | readonly string[]> = JoinByCase<\n T,\n \"_\"\n>;\n\nexport type TrainCase<\n T,\n Normalize extends boolean | undefined = false,\n Joiner extends string = \"-\"\n> = string extends T\n ? string\n : string[] extends T\n ? string\n : T extends string\n ? SplitByCase<T> extends readonly string[]\n ? CapitalizedWords<SplitByCase<T>, Joiner>\n : never\n : T extends readonly string[]\n ? CapitalizedWords<T, Joiner, Normalize>\n : never;\n\nexport type FlatCase<\n T extends string | readonly string[],\n Joiner extends string = \"\"\n> = JoinByCase<T, Joiner>;\n\nconst NUMBER_CHAR_RE = /\\d/;\nconst STR_SPLITTERS = [\"-\", \"_\", \"/\", \".\"] as const;\n\nexport function isUppercase(char = \"\"): boolean | undefined {\n if (NUMBER_CHAR_RE.test(char)) {\n return undefined;\n }\n return char !== char.toLowerCase();\n}\n\nexport function splitByCase<T extends string>(str: T): SplitByCase<T>;\nexport function splitByCase<\n T extends string,\n Separator extends readonly string[]\n>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;\nexport function splitByCase<\n T extends string,\n Separator extends readonly string[]\n>(str: T, separators?: Separator) {\n const splitters = separators ?? STR_SPLITTERS;\n const parts: string[] = [];\n\n if (!str || typeof str !== \"string\") {\n return parts as SplitByCase<T, Separator[number]>;\n }\n\n let buff = \"\";\n\n let previousUpper: boolean | undefined;\n let previousSplitter: boolean | undefined;\n\n for (const char of str) {\n // Splitter\n const isSplitter = (splitters as unknown as string).includes(char);\n if (isSplitter === true) {\n parts.push(buff);\n buff = \"\";\n previousUpper = undefined;\n continue;\n }\n\n const isUpper = isUppercase(char);\n if (previousSplitter === false) {\n // Case rising edge\n if (previousUpper === false && isUpper === true) {\n parts.push(buff);\n buff = char;\n previousUpper = isUpper;\n continue;\n }\n // Case falling edge\n if (previousUpper === true && isUpper === false && buff.length > 1) {\n const lastChar = buff.at(-1);\n parts.push(buff.slice(0, Math.max(0, buff.length - 1)));\n buff = lastChar + char;\n previousUpper = isUpper;\n continue;\n }\n }\n\n // Normal char\n buff += char;\n previousUpper = isUpper;\n previousSplitter = isSplitter;\n }\n\n parts.push(buff);\n\n return parts as SplitByCase<T, Separator[number]>;\n}\n\nexport function upperFirst<S extends string>(str: S): Capitalize<S> {\n return (str ? str[0].toUpperCase() + str.slice(1) : \"\") as Capitalize<S>;\n}\n\nexport function lowerFirst<S extends string>(str: S): Uncapitalize<S> {\n return (str ? str[0].toLowerCase() + str.slice(1) : \"\") as Uncapitalize<S>;\n}\n\nexport function pascalCase(): \"\";\nexport function pascalCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions[\"normalize\"]>;\nexport function pascalCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return str\n ? ((Array.isArray(str) ? str : splitByCase(str as string))\n .map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p))\n .join(\"\") as PascalCase<T, UserCaseOptions[\"normalize\"]>)\n : \"\";\n}\n\nexport function camelCase(): \"\";\nexport function camelCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions[\"normalize\"]>;\nexport function camelCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return lowerFirst(pascalCase(str || \"\", opts)) as CamelCase<\n T,\n UserCaseOptions[\"normalize\"]\n >;\n}\n\nexport function kebabCase(): \"\";\nexport function kebabCase<T extends string | readonly string[]>(\n str: T\n): KebabCase<T>;\nexport function kebabCase<\n T extends string | readonly string[],\n Joiner extends string\n>(str: T, joiner: Joiner): KebabCase<T, Joiner>;\nexport function kebabCase<\n T extends string | readonly string[],\n Joiner extends string\n>(str?: T, joiner?: Joiner) {\n return str\n ? ((Array.isArray(str) ? str : splitByCase(str as string))\n .map((p) => p.toLowerCase())\n .join(joiner ?? \"-\") as KebabCase<T, Joiner>)\n : \"\";\n}\n\nexport function snakeCase(): \"\";\nexport function snakeCase<T extends string | readonly string[]>(\n str: T\n): SnakeCase<T>;\nexport function snakeCase<T extends string | readonly string[]>(str?: T) {\n return kebabCase(str || \"\", \"_\") as SnakeCase<T>;\n}\n\nexport function flatCase(): \"\";\nexport function flatCase<T extends string | readonly string[]>(\n str: T\n): FlatCase<T>;\nexport function flatCase<T extends string | readonly string[]>(str?: T) {\n return kebabCase(str || \"\", \"\") as FlatCase<T>;\n}\n\nexport function trainCase(): \"\";\nexport function trainCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions[\"normalize\"]>;\nexport function trainCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return (Array.isArray(str) ? str : splitByCase(str as string))\n .filter(Boolean)\n .map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p))\n .join(\"-\") as TrainCase<T, UserCaseOptions[\"normalize\"]>;\n}\n\nconst titleCaseExceptions =\n /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;\n\nexport function titleCase(): \"\";\nexport function titleCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(\n str: T,\n opts?: UserCaseOptions\n): TrainCase<T, UserCaseOptions[\"normalize\"], \" \">;\nexport function titleCase<\n T extends string | readonly string[],\n UserCaseOptions extends CaseOptions = CaseOptions\n>(str?: T, opts?: UserCaseOptions) {\n return (Array.isArray(str) ? str : splitByCase(str as string))\n .filter(Boolean)\n .map((p) =>\n titleCaseExceptions.test(p)\n ? p.toLowerCase()\n : upperFirst(opts?.normalize ? p.toLowerCase() : p)\n )\n .join(\" \") as TrainCase<T, UserCaseOptions[\"normalize\"]>;\n}\n"],"mappings":";AAMA,MAAM,WAA8C,QAAuB;AACzE,QAAO,OAAO,QAAQ,IAAI;;;;;ACH5B,MAAM,eACJ,cACmB;AACnB,QAAOA,UAAQ,QAAQ,KAAK,QAAQ;AAClC,SAAO;GACL,GAAG;IACF,IAAI,KAAK,IAAI;GACf;IACA,EAAE,CAAmB;;;;;AC2J1B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;CAAC;CAAK;CAAK;CAAK;CAAI;AAE1C,SAAgB,YAAY,OAAO,IAAyB;AAC1D,KAAI,eAAe,KAAK,KAAK,CAC3B;AAEF,QAAO,SAAS,KAAK,aAAa;;AAQpC,SAAgB,YAGd,KAAQ,YAAwB;CAChC,MAAM,YAAY,cAAc;CAChC,MAAMC,QAAkB,EAAE;AAE1B,KAAI,CAAC,OAAO,OAAO,QAAQ,SACzB,QAAO;CAGT,IAAI,OAAO;CAEX,IAAIC;CACJ,IAAIC;AAEJ,MAAK,MAAM,QAAQ,KAAK;EAEtB,MAAM,aAAc,UAAgC,SAAS,KAAK;AAClE,MAAI,eAAe,MAAM;AACvB,SAAM,KAAK,KAAK;AAChB,UAAO;AACP,mBAAgB;AAChB;;EAGF,MAAM,UAAU,YAAY,KAAK;AACjC,MAAI,qBAAqB,OAAO;AAE9B,OAAI,kBAAkB,SAAS,YAAY,MAAM;AAC/C,UAAM,KAAK,KAAK;AAChB,WAAO;AACP,oBAAgB;AAChB;;AAGF,OAAI,kBAAkB,QAAQ,YAAY,SAAS,KAAK,SAAS,GAAG;IAClE,MAAM,WAAW,KAAK,GAAG,GAAG;AAC5B,UAAM,KAAK,KAAK,MAAM,GAAG,KAAK,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC,CAAC;AACvD,WAAO,WAAW;AAClB,oBAAgB;AAChB;;;AAKJ,UAAQ;AACR,kBAAgB;AAChB,qBAAmB;;AAGrB,OAAM,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,WAA6B,KAAuB;AAClE,QAAQ,MAAM,IAAI,GAAG,aAAa,GAAG,IAAI,MAAM,EAAE,GAAG;;AAGtD,SAAgB,WAA6B,KAAyB;AACpE,QAAQ,MAAM,IAAI,GAAG,aAAa,GAAG,IAAI,MAAM,EAAE,GAAG;;AAQtD,SAAgB,WAGd,KAAS,MAAwB;AACjC,QAAO,OACD,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EACpD,KAAK,MAAM,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CAAC,CAC7D,KAAK,GAAG,GACX;;AAQN,SAAgB,UAGd,KAAS,MAAwB;AACjC,QAAO,WAAW,WAAW,OAAO,IAAI,KAAK,CAAC;;AAchD,SAAgB,UAGd,KAAS,QAAiB;AAC1B,QAAO,OACD,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EACpD,KAAK,MAAM,EAAE,aAAa,CAAC,CAC3B,KAAK,UAAU,IAAI,GACtB;;AAON,SAAgB,UAAgD,KAAS;AACvE,QAAO,UAAU,OAAO,IAAI,IAAI;;AAOlC,SAAgB,SAA+C,KAAS;AACtE,QAAO,UAAU,OAAO,IAAI,GAAG;;AAQjC,SAAgB,UAGd,KAAS,MAAwB;AACjC,SAAQ,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EAC1D,OAAO,QAAQ,CACf,KAAK,MAAM,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CAAC,CAC7D,KAAK,IAAI;;AAGd,MAAM,sBACJ;AAUF,SAAgB,UAGd,KAAS,MAAwB;AACjC,SAAQ,MAAM,QAAQ,IAAI,GAAG,MAAM,YAAY,IAAc,EAC1D,OAAO,QAAQ,CACf,KAAK,MACJ,oBAAoB,KAAK,EAAE,GACvB,EAAE,aAAa,GACf,WAAW,MAAM,YAAY,EAAE,aAAa,GAAG,EAAE,CACtD,CACA,KAAK,IAAI"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@dathomir/shared",
3
+ "description": "dathomir shared package",
4
+ "version": "0.0.1-beta.0",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "type": "module",
10
+ "license": "MPL-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+ssh://git@github.com:dathomir-js/dathomir.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/dathomir-js/dathomir/issues",
17
+ "email": "dathomir@takumaru.dev"
18
+ },
19
+ "homepage": "https://github.com/dathomir-js/dathomir#readme",
20
+ "author": "takuma-ru <takuma-ru@takumaru.dev> (https://github.com/takuma-ru/)",
21
+ "keywords": [
22
+ "dathomir",
23
+ "framework",
24
+ "frontend",
25
+ "javascript",
26
+ "typescript"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "import": "./dist/index.mjs",
31
+ "require": "./dist/index.cjs",
32
+ "types": "./dist/index.d.mts"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "devDependencies": {
39
+ "@takuma-ru/rlse": "0.0.1-beta.8",
40
+ "@dathomir/config": "0.0.0"
41
+ },
42
+ "scripts": {
43
+ "dev": "tsdown --watch",
44
+ "build": "tsdown",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "oxlint",
47
+ "release": "rlse"
48
+ }
49
+ }