@arkyn/shared 3.0.1-beta.201 → 3.0.1-beta.204
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.txt +184 -1
- package/README.md +2 -2
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/formats/formatDate.js +2 -0
- package/dist/modules/formats/formatDate.js.map +1 -0
- package/dist/modules/formats/formatJsonObject.js +2 -0
- package/dist/modules/formats/formatJsonObject.js.map +1 -0
- package/dist/modules/formats/formatJsonString.js +2 -0
- package/dist/modules/formats/formatJsonString.js.map +1 -0
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js +2 -0
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js.map +1 -0
- package/dist/modules/formats/formatToCep.js +2 -0
- package/dist/modules/formats/formatToCep.js.map +1 -0
- package/dist/modules/formats/formatToCnpj.js +2 -0
- package/dist/modules/formats/formatToCnpj.js.map +1 -0
- package/dist/modules/formats/formatToCpf.js +2 -0
- package/dist/modules/formats/formatToCpf.js.map +1 -0
- package/dist/modules/formats/formatToCurrency.js +2 -0
- package/dist/modules/formats/formatToCurrency.js.map +1 -0
- package/dist/modules/formats/formatToEllipsis.js +2 -0
- package/dist/modules/formats/formatToEllipsis.js.map +1 -0
- package/dist/modules/formats/formatToHiddenDigits.js +2 -0
- package/dist/modules/formats/formatToHiddenDigits.js.map +1 -0
- package/dist/modules/formats/formatToPhone.js +2 -0
- package/dist/modules/formats/formatToPhone.js.map +1 -0
- package/dist/modules/generators/generateColorByString.js +2 -0
- package/dist/modules/generators/generateColorByString.js.map +1 -0
- package/dist/modules/generators/generateId.js +2 -0
- package/dist/modules/generators/generateId.js.map +1 -0
- package/dist/modules/generators/generateSlug.js +2 -0
- package/dist/modules/generators/generateSlug.js.map +1 -0
- package/dist/modules/parsers/parseLargeFields.js +2 -0
- package/dist/modules/parsers/parseLargeFields.js.map +1 -0
- package/dist/modules/parsers/parseSensitiveData.js +2 -0
- package/dist/modules/parsers/parseSensitiveData.js.map +1 -0
- package/dist/modules/parsers/parseToDate.js +2 -0
- package/dist/modules/parsers/parseToDate.js.map +1 -0
- package/dist/modules/services/validateDateService.js +2 -0
- package/dist/modules/services/validateDateService.js.map +1 -0
- package/dist/modules/utilities/calculateCardInstallment.js +2 -0
- package/dist/modules/utilities/calculateCardInstallment.js.map +1 -0
- package/dist/modules/utilities/ensureQuotes.js +2 -0
- package/dist/modules/utilities/ensureQuotes.js.map +1 -0
- package/dist/modules/utilities/findCountryMask.js +2 -0
- package/dist/modules/utilities/findCountryMask.js.map +1 -0
- package/dist/modules/utilities/isHtml.js +2 -0
- package/dist/modules/utilities/isHtml.js.map +1 -0
- package/dist/modules/utilities/removeCurrencySymbols.js +2 -0
- package/dist/modules/utilities/removeCurrencySymbols.js.map +1 -0
- package/dist/modules/utilities/removeNonNumeric.js +2 -0
- package/dist/modules/utilities/removeNonNumeric.js.map +1 -0
- package/dist/modules/utilities/stripHtmlTags.js +2 -0
- package/dist/modules/utilities/stripHtmlTags.js.map +1 -0
- package/package.json +95 -5
- package/dist/modules/index.js +0 -26
package/LICENSE.txt
CHANGED
|
@@ -1,10 +1,193 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
4
5
|
|
|
5
6
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 - Arkyn | Lucas Eduardo Gonçalves
|
|
8
191
|
|
|
9
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ Comprehensive collection of reusable utilities for data formatting, validation,
|
|
|
25
25
|
|
|
26
26
|
## 📋 Prerequisites
|
|
27
27
|
|
|
28
|
-
- **Node.js** `>=
|
|
29
|
-
- **Bun** `>=1.
|
|
28
|
+
- **Node.js** `>=18.0.0`
|
|
29
|
+
- **Bun** `>=1.0.0`
|
|
30
30
|
- **`libphonenumber-js`** `>=1.13.7` — optional peer dependency, required only if you use `formatToPhone` or `findCountryMask`
|
|
31
31
|
|
|
32
32
|
## 📦 Installation
|
package/dist/index.js
CHANGED
|
@@ -369,3 +369,5 @@ function F(e) {
|
|
|
369
369
|
}
|
|
370
370
|
//#endregion
|
|
371
371
|
export { r as ValidateDateService, M as calculateCardInstallment, N as ensureQuotes, x as findCountryMask, a as formatDate, o as formatJsonObject, s as formatJsonString, c as formatToCapitalizeFirstWordLetter, u as formatToCep, d as formatToCnpj, f as formatToCpf, m as formatToCurrency, h as formatToEllipsis, b as formatToHiddenDigits, S as formatToPhone, C as generateColorByString, D as generateId, O as generateSlug, P as isHtml, k as parseLargeFields, A as parseSensitiveData, j as parseToDate, p as removeCurrencySymbols, l as removeNonNumeric, F as stripHtmlTags };
|
|
372
|
+
|
|
373
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/services/validateDateService.ts","../src/formats/formatDate.ts","../src/formats/formatJsonObject.ts","../src/formats/formatJsonString.ts","../src/formats/formatToCapitalizeFirstWordLetter.ts","../src/utilities/removeNonNumeric.ts","../src/formats/formatToCep.ts","../src/formats/formatToCnpj.ts","../src/formats/formatToCpf.ts","../src/utilities/removeCurrencySymbols.ts","../src/formats/formatToCurrency.ts","../src/formats/formatToEllipsis.ts","../src/formats/formatToHiddenDigits.ts","../src/utilities/findCountryMask.ts","../src/formats/formatToPhone.ts","../src/generators/generateColorByString.ts","../src/generators/generateId.ts","../src/generators/generateSlug.ts","../src/parsers/parseLargeFields.ts","../src/parsers/parseSensitiveData.ts","../src/parsers/parseToDate.ts","../src/utilities/calculateCardInstallment.ts","../src/utilities/ensureQuotes.ts","../src/utilities/isHtml.ts","../src/utilities/stripHtmlTags.ts"],"sourcesContent":["/**\n * Validates date components and input format strings for date-parsing utilities.\n * Enforces 4-digit years, month/day ranges, month-specific day counts, and leap year rules.\n *\n * @example\n * ```typescript\n * const service = new ValidateDateService();\n * service.validateDateParts(2024, 2, 29); // OK — leap year\n * service.validateDateParts(2023, 2, 29); // throws — not a leap year\n * service.validateInputFormat(\"brazilianDate\"); // OK\n * service.validateInputFormat(\"custom\"); // throws\n * ```\n */\n\nclass ValidateDateService {\n\tprivate isLeapYear(year: number): boolean {\n\t\treturn (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\t}\n\n\tprivate getDaysInMonth(month: number, year: number): number {\n\t\tconst daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\t\tif (month === 2 && this.isLeapYear(year)) return 29;\n\t\treturn daysInMonth[month - 1];\n\t}\n\n\tprivate validateDayInMonth(day: number, month: number, year: number): void {\n\t\tconst maxDays = this.getDaysInMonth(month, year);\n\n\t\tif (day > maxDays) {\n\t\t\tconst monthNames = [\n\t\t\t\t\"January\",\n\t\t\t\t\"February\",\n\t\t\t\t\"March\",\n\t\t\t\t\"April\",\n\t\t\t\t\"May\",\n\t\t\t\t\"June\",\n\t\t\t\t\"July\",\n\t\t\t\t\"August\",\n\t\t\t\t\"September\",\n\t\t\t\t\"October\",\n\t\t\t\t\"November\",\n\t\t\t\t\"December\",\n\t\t\t];\n\n\t\t\tconst errorMessage = `Day ${day} is not valid for ${monthNames[month - 1]}`;\n\t\t\tconst leapYearMessage = `Day ${day} is not valid for February ${year} (non-leap year)`;\n\n\t\t\tif (month === 2 && day === 29) throw new Error(leapYearMessage);\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\t}\n\n\t/**\n\t * Throws if year, month, or day are out of valid range or inconsistent with the calendar.\n\t *\n\t * @param year - 4-digit year (1000–9999).\n\t * @param month - Month number (1–12).\n\t * @param day - Day number (1–31, validated against the specific month).\n\t */\n\tvalidateDateParts(year: number, month: number, day: number): void {\n\t\tconst messageErrors = {\n\t\t\tyear: \"Year should be four digits\",\n\t\t\tmonth: \"Month should be between 1 and 12\",\n\t\t\tday: \"Day should be between 1 and 31\",\n\t\t};\n\n\t\tif (`${year}`.length !== 4) throw new Error(messageErrors.year);\n\t\tif (month < 1 || month > 12) throw new Error(messageErrors.month);\n\t\tif (day < 1 || day > 31) throw new Error(messageErrors.day);\n\n\t\tthis.validateDayInMonth(day, month, year);\n\t}\n\n\t/**\n\t * Throws if `format` is not one of `\"brazilianDate\"`, `\"isoDate\"`, or `\"timestamp\"`.\n\t *\n\t * @param format - The format string to check.\n\t */\n\tvalidateInputFormat(format: string): void {\n\t\tconst validFormats = [\"brazilianDate\", \"isoDate\", \"timestamp\"];\n\t\tif (!validFormats.includes(format)) {\n\t\t\tthrow new Error(`Invalid input format: ${format}`);\n\t\t}\n\t}\n}\n\nexport { ValidateDateService };\n","import { ValidateDateService } from \"../services/validateDateService\";\n\nfunction formatDateString(date: Date, format: string): string {\n\tconst pad = (num: number) => num.toString().padStart(2, \"0\");\n\n\tconst replacements: Record<string, string> = {\n\t\tYYYY: date.getUTCFullYear().toString(),\n\t\tYY: date.getUTCFullYear().toString().slice(-2),\n\t\tMM: pad(date.getUTCMonth() + 1),\n\t\tDD: pad(date.getUTCDate()),\n\t\thh: pad(date.getUTCHours()),\n\t\tmm: pad(date.getUTCMinutes()),\n\t\tss: pad(date.getUTCSeconds()),\n\t};\n\n\treturn format.replace(\n\t\t/YYYY|YY|MM|DD|hh|mm|ss/g,\n\t\t(match) => replacements[match],\n\t);\n}\n\n/**\n * Formats a date (and optional time) string into a custom output format.\n * All calculations are in UTC+0; use the `timezone` parameter to shift the result.\n *\n * @param date - Date string in the format determined by `inputFormat`.\n * @param time - Optional time string `\"HH:mm:ss\"` (defaults to `\"00:00:00\"`).\n * @param inputFormat - Parsing format:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"isoDate\"`: MM-DD-YYYY\n * - `\"timestamp\"`: YYYY-MM-DD\n * @param outputFormat - Output template using `YYYY`, `MM`, `DD`, `hh`, `mm`, `ss` placeholders.\n * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.\n * @returns The formatted date string.\n *\n * @example\n * ```typescript\n * formatDate([\"25/12/2023\", \"15:30:00\"], \"brazilianDate\", \"YYYY-MM-DD hh:mm\");\n * // \"2023-12-25 15:30\"\n *\n * formatDate([\"2023-12-25\", \"15:30:00\"], \"timestamp\", \"DD/MM/YYYY hh:mm\", -3);\n * // \"2023-12-25 12:30\"\n * ```\n */\n\nfunction formatDate(\n\t[date, time = \"00:00:00\"]: string[],\n\tinputFormat: \"brazilianDate\" | \"isoDate\" | \"timestamp\",\n\toutputFormat: string,\n\ttimezone: number = 0,\n): string {\n\tconst validateDateService = new ValidateDateService();\n\tvalidateDateService.validateInputFormat(inputFormat);\n\n\tconst dateParts = date.split(/[-/]/).map(Number);\n\tconst timeParts = time.split(\".\")[0].split(\":\").map(Number);\n\n\tlet day: number, month: number, year: number;\n\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\n\tswitch (inputFormat) {\n\t\tcase \"brazilianDate\":\n\t\t\t[day, month, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"isoDate\":\n\t\t\t[month, day, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"timestamp\":\n\t\t\t[year, month, day] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t}\n\n\tconst formattedDate = new Date(\n\t\tDate.UTC(year, month - 1, day, hours, minutes, seconds),\n\t);\n\n\tif (Number.isNaN(formattedDate.getTime())) throw new Error(\"Invalid date\");\n\n\tformattedDate.setUTCHours(formattedDate.getUTCHours() + timezone);\n\n\treturn formatDateString(formattedDate, outputFormat);\n}\n\nexport { formatDate };\n","/**\n * Formats a JSON object into a human-readable string with proper indentation.\n *\n * - If the input is an object, it will be formatted with keys and values properly indented.\n * - If the input is an array, each element will be formatted and indented on a new line.\n * - If the input is a string that can be parsed as JSON, it will attempt to parse and format it.\n * - Primitive values (e.g., numbers, booleans, null) will be converted to their string representation.\n *\n * @param json - The value to format: object, array, string, or primitive.\n * @param indentLevel - Current indentation depth (used recursively; pass `0` at the top level).\n * @returns A pretty-printed string representation of the value.\n *\n * @example\n * ```typescript\n * const obj = { name: \"John\", age: 30, hobbies: [\"reading\", \"gaming\"] };\n * const formatted = formatJsonObject(obj, 0);\n * console.log(formatted);\n * // Output:\n * // {\n * // \"name\": \"John\",\n * // \"age\": 30,\n * // \"hobbies\": [\n * // \"reading\",\n * // \"gaming\"\n * // ]\n * // }\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nconst formatJsonObject = (json: any, indentLevel: number): string => {\n\tconst indent = \" \".repeat(indentLevel);\n\tlet formattedString = \"\";\n\n\tif (typeof json === \"object\" && json !== null) {\n\t\tif (Array.isArray(json)) {\n\t\t\tif (json.length === 0) {\n\t\t\t\t// Caso especial para arrays vazios\n\t\t\t\tformattedString += \"[]\";\n\t\t\t} else {\n\t\t\t\tformattedString += \"[\\n\";\n\t\t\t\tjson.forEach((item, index) => {\n\t\t\t\t\tformattedString += `${indent} ${formatJsonObject(item, indentLevel + 1)}`;\n\t\t\t\t\tif (index < json.length - 1) {\n\t\t\t\t\t\tformattedString += \",\";\n\t\t\t\t\t}\n\t\t\t\t\tformattedString += \"\\n\";\n\t\t\t\t});\n\t\t\t\tformattedString += `${indent}]`;\n\t\t\t}\n\t\t} else {\n\t\t\tconst keys = Object.keys(json);\n\t\t\tif (keys.length === 0) {\n\t\t\t\t// Caso especial para objetos vazios\n\t\t\t\tformattedString += \"{}\";\n\t\t\t} else {\n\t\t\t\tformattedString += \"{\\n\";\n\t\t\t\tkeys.forEach((key, index) => {\n\t\t\t\t\tformattedString +=\n\t\t\t\t\t\tindent +\n\t\t\t\t\t\t' \"' +\n\t\t\t\t\t\tkey +\n\t\t\t\t\t\t'\": ' +\n\t\t\t\t\t\tformatJsonObject(json[key], indentLevel + 1);\n\t\t\t\t\tif (index < keys.length - 1) {\n\t\t\t\t\t\tformattedString += \",\";\n\t\t\t\t\t}\n\t\t\t\t\tformattedString += \"\\n\";\n\t\t\t\t});\n\t\t\t\tformattedString += `${indent}}`;\n\t\t\t}\n\t\t}\n\t} else if (typeof json === \"string\") {\n\t\ttry {\n\t\t\tconst parsedObj = JSON.parse(json);\n\t\t\tformattedString += formatJsonObject(parsedObj, indentLevel);\n\t\t} catch {\n\t\t\tformattedString += `\"${json}\"`;\n\t\t}\n\t} else {\n\t\tformattedString += json;\n\t}\n\n\treturn formattedString;\n};\n\nexport { formatJsonObject };\n","import { formatJsonObject } from \"./formatJsonObject\";\n\ntype FormatJsonStringFunction = (jsonString: string) => string;\n\n/**\n * Parses a JSON string and returns a human-readable pretty-printed representation.\n * Throws if the input is not valid JSON.\n *\n * @param jsonString - A valid JSON string to format.\n * @returns A pretty-printed string representation.\n *\n * @example\n * ```typescript\n * formatJsonString('{\"name\":\"John\",\"hobbies\":[\"reading\",\"gaming\"]}');\n * // {\n * // \"name\": \"John\",\n * // \"hobbies\": [\n * // \"reading\",\n * // \"gaming\"\n * // ]\n * // }\n * ```\n */\n\nconst formatJsonString: FormatJsonStringFunction = (jsonString) => {\n\ttry {\n\t\tconst jsonObject = JSON.parse(jsonString);\n\t\treturn formatJsonObject(jsonObject, 0);\n\t} catch (error) {\n\t\tthrow new Error(`Invalid JSON string \\n ${error}`);\n\t}\n};\n\nexport { formatJsonString };\n","/**\n * Capitalizes the first letter of each word and lowercases the rest.\n * Words are separated by spaces.\n *\n * @param sentence - The string to format.\n * @returns The sentence with every word title-cased.\n *\n * @example\n * ```typescript\n * formatToCapitalizeFirstWordLetter(\"hello world\"); // \"Hello World\"\n * formatToCapitalizeFirstWordLetter(\"HELLO WORLD\"); // \"Hello World\"\n * ```\n */\n\nfunction formatToCapitalizeFirstWordLetter(sentence: string) {\n\tconst words = sentence.split(\" \");\n\n\tconst capitalizedWords = words.map((word) => {\n\t\tconst firstLetter = word.charAt(0).toUpperCase();\n\t\tconst restOfWord = word.slice(1).toLowerCase();\n\t\treturn firstLetter + restOfWord;\n\t});\n\n\treturn capitalizedWords.join(\" \");\n}\n\nexport { formatToCapitalizeFirstWordLetter };\n","/**\n * Removes all non-numeric characters from a given string.\n *\n * @param rawString - The input string to strip non-numeric characters from.\n * @returns A new string containing only the numeric characters from the input.\n *\n * @example\n * ```typescript\n * const result = removeNonNumeric(\"abc123def456\");\n * console.log(result); // Output: \"123456\"\n * ```\n */\n\nfunction removeNonNumeric(rawString: string): string {\n\treturn rawString.replace(/[^0-9]/g, \"\");\n}\n\nexport { removeNonNumeric };\n","import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string into a Brazilian postal code (CEP) format.\n *\n * The function removes all non-numeric characters from the input string\n * and attempts to format it as a CEP in the pattern `XXXXX-XXX`.\n * If the input does not match the expected format, an error is thrown.\n *\n * @param value - Input string with 8 numeric digits (special characters are stripped).\n * @returns The formatted CEP string in the pattern `XXXXX-XXX`.\n *\n * @throws {Error} If the input does not match the expected CEP format.\n *\n * @example\n * ```typescript\n * const formattedCep = formatToCep(\"12345678\");\n * console.log(formattedCep); // Output: \"12345-678\"\n * ```\n */\n\nfunction formatToCep(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{5})(\\d{3})$/);\n\n\tconst errorMessage = `CEP must be contain 8 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}-${match[2]}`;\n}\n\nexport { formatToCep };\n","import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.\n *\n * The CNPJ format is: `XX.XXX.XXX/XXXX-XX`, where `X` represents a digit.\n *\n * @param value - Input string with 14 numeric digits (special characters are stripped).\n * @returns The formatted CNPJ string in the pattern `XX.XXX.XXX/XXXX-XX`.\n *\n * @throws {Error} Throws an error if the input does not contain exactly 14 numeric digits.\n *\n * @example\n * ```typescript\n * const formattedCnpj = formatToCnpj(\"12345678000195\");\n * console.log(formattedCnpj); // Output: \"12.345.678/0001-95\"\n * ```\n */\n\nfunction formatToCnpj(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})$/);\n\n\tconst errorMessage = `CNPJ must be contain 14 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}.${match[2]}.${match[3]}/${match[4]}-${match[5]}`;\n}\n\nexport { formatToCnpj };\n","import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.\n *\n * A CPF is a Brazilian individual taxpayer registry identification format.\n * This function ensures the input is cleaned of non-numeric characters and\n * then formats it into the standard CPF format: `XXX.XXX.XXX-XX`.\n *\n * @param value - Input string with 11 numeric digits (special characters are stripped).\n * @returns The formatted CPF string in the pattern `XXX.XXX.XXX-XX`.\n *\n * @throws {Error} If the input string does not match the expected CPF format.\n *\n * @example\n * ```typescript\n * const formattedCpf = formatToCpf(\"12345678909\");\n * console.log(formattedCpf); // Output: \"123.456.789-09\"\n * ```\n */\n\nfunction formatToCpf(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{3})(\\d{3})(\\d{3})(\\d{2})$/);\n\n\tconst errorMessage = `CPF must be contain 11 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}.${match[2]}.${match[3]}-${match[4]}`;\n}\n\nexport { formatToCpf };\n","/**\n * Removes currency symbols from a given formatted string.\n *\n * This function takes a string that may contain currency symbols\n * and removes them using a regular expression. The resulting string\n * is also trimmed of any leading or trailing whitespace.\n *\n * @param rawString - The formatted string that may contain currency symbols.\n * @returns The string with all currency symbols removed and trimmed of whitespace.\n *\n * @example\n * ```typescript\n * removeCurrencySymbols(\"R$13,45\"); // \"13,45\"\n * removeCurrencySymbols(\"$123.45\"); // \"123.45\"\n * removeCurrencySymbols(\"€99.99\"); // \"99.99\"\n * removeCurrencySymbols(\"¥1,000\"); // \"1,000\"\n * removeCurrencySymbols(\"123.45\"); // \"123.45\" (no symbols to remove)\n * ```\n */\n\nfunction removeCurrencySymbols(rawString: string): string {\n\treturn rawString.replace(/(?:R\\$|\\p{Sc}|[$€¥£])/gu, \"\").trim();\n}\n\nexport { removeCurrencySymbols };\n","import { countryCurrencies } from \"@arkyn/templates\";\nimport { removeCurrencySymbols } from \"../utilities/removeCurrencySymbols\";\n\ntype Currencies = keyof typeof countryCurrencies;\n\n/**\n * Formats a number into a locale-aware currency string using `Intl.NumberFormat`.\n *\n * @param value - The numeric value to format.\n * @param currency - A currency code from `@arkyn/templates` (e.g. `\"BRL\"`, `\"USD\"`).\n * @param config.showPrefix - Whether to include the currency symbol. Defaults to `true`.\n * @returns The formatted currency string.\n *\n * @example\n * ```typescript\n * formatToCurrency(1234.56, \"BRL\"); // \"R$ 1.234,56\"\n * formatToCurrency(1234.56, \"USD\", { showPrefix: false }); // \"1,234.56\"\n * ```\n */\nfunction formatToCurrency(\n\tvalue: number,\n\tcurrency: Currencies,\n\tconfig?: { showPrefix?: boolean },\n): string {\n\tif (!countryCurrencies?.[currency]) {\n\t\tthrow new Error(\"Unsupported currency code\");\n\t}\n\n\tconst showPrefix = config?.showPrefix ?? true;\n\n\tconst { countryCurrency, countryLanguage } = countryCurrencies[currency];\n\n\tconst format = new Intl.NumberFormat(countryLanguage, {\n\t\tstyle: \"currency\",\n\t\tcurrency: countryCurrency,\n\t}).format(value);\n\n\treturn showPrefix\n\t\t? format.replace(/\\s/g, \" \")\n\t\t: removeCurrencySymbols(format).replace(/\\s/g, \" \");\n}\n\nexport { formatToCurrency };\n","/**\n * Truncates a given text to a specified maximum length and appends an ellipsis (\"...\")\n * if the text exceeds the maximum length.\n *\n * @param text - The input string to be truncated.\n * @param maxLength - Maximum allowed length before truncation.\n * @returns The truncated string with `\"...\"` appended, or the original string if it fits.\n * @example\n * ```typescript\n * const result = formatToEllipsis(\"Hello, world!\", 5);\n * console.log(result); // Output: \"Hello...\"\n * ```\n */\n\nfunction formatToEllipsis(text: string, maxLength: number): string {\n\tif (text.length > maxLength) {\n\t\tlet trimmedText = text.substring(0, maxLength);\n\n\t\t// Find the last space to avoid breaking words\n\t\tconst lastSpaceIndex = trimmedText.lastIndexOf(\" \");\n\t\tif (lastSpaceIndex > 0) {\n\t\t\ttrimmedText = trimmedText.substring(0, lastSpaceIndex);\n\t\t}\n\n\t\t// Remove trailing punctuation\n\t\ttrimmedText = trimmedText.replace(/[\\s.,!?;:]+$/, \"\");\n\n\t\t// If after removing punctuation the text is empty or only contains punctuation/spaces, return only \"...\"\n\t\tif (trimmedText.trim().length === 0 || /^[.,!?;:\\s]+$/.test(trimmedText)) {\n\t\t\treturn \"...\";\n\t\t}\n\n\t\treturn `${trimmedText}...`;\n\t}\n\n\treturn text;\n}\n\nexport { formatToEllipsis };\n","const DIGIT = /^\\d$/;\n\ntype DigitCharacterNode = {\n\tkind: \"digit\";\n\tdigit: number;\n\tcharacter: string;\n};\n\ntype OtherCharacterNode = {\n\tkind: \"other\";\n\tcharacter: string;\n};\n\ntype RootCharacterNode = {\n\tkind: \"root\";\n\tdigits: number;\n\tchildren: (DigitCharacterNode | OtherCharacterNode)[];\n};\n\nconst parseToCharacters = (value: string): RootCharacterNode => {\n\tlet digits = 0;\n\n\tconst children = value\n\t\t.split(\"\")\n\t\t.map((character: string): DigitCharacterNode | OtherCharacterNode => {\n\t\t\tif (DIGIT.test(character))\n\t\t\t\treturn { character, kind: \"digit\", digit: ++digits };\n\t\t\treturn { character, kind: \"other\" };\n\t\t});\n\n\treturn { digits, children, kind: \"root\" };\n};\n\nconst normalizeRange = (\n\trange: number | [number, number],\n\tlimit: number,\n): [number, number] => {\n\tif (Array.isArray(range)) return range;\n\tif (range >= 0) return [0, range];\n\treturn [limit + 1 - Math.abs(range), limit];\n};\n\nconst within = (range: [number, number], value: number): boolean =>\n\tvalue >= range[0] && value <= range[1];\n\n/**\n * Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.\n *\n * @param value - The input string to mask.\n * @param options.range - Which digits to hide:\n * - Positive number `n` — hides the first `n` digits.\n * - Negative number `-n` — hides the last `n` digits.\n * - Tuple `[start, end]` — hides digits from position `start` to `end` (inclusive, 1-indexed).\n * - Defaults to `3`.\n * @param options.hider - The masking character. Defaults to `\"*\"`.\n * @returns The string with the specified digit positions replaced.\n *\n * @example\n * ```typescript\n * formatToHiddenDigits(\"123-456-7890\", { range: 3 }); // \"***-456-7890\"\n * formatToHiddenDigits(\"123-456-7890\", { range: [4, 6], hider: \"#\" }); // \"123-###-7890\"\n * ```\n */\n\nfunction formatToHiddenDigits(\n\tvalue: string,\n\toptions?: { range?: number | [number, number]; hider?: string },\n): string {\n\tconst characters = parseToCharacters(value);\n\tconst range = normalizeRange(options?.range ?? 3, characters.digits);\n\n\tconst mappedCharacters = characters.children.map((node) => {\n\t\tif (node.kind === \"digit\" && within(range, node.digit))\n\t\t\treturn options?.hider ?? \"*\";\n\t\treturn node.character;\n\t});\n\n\treturn mappedCharacters.join(\"\");\n}\n\nexport { formatToHiddenDigits };\n","import { type CountryType, countries } from \"@arkyn/templates\";\nimport { parsePhoneNumberWithError } from \"libphonenumber-js\";\nimport { removeNonNumeric } from \"./removeNonNumeric\";\n\n/**\n * Resolves the matching phone mask and country metadata for a given phone number.\n * Masks use `\"_\"` as digit placeholders. For countries with multiple mask lengths\n * (e.g. Brazil with and without the ninth digit), the mask matching the number's\n * digit count is returned.\n *\n * @param phoneNumber - Phone number in E.164 format (e.g. `\"+5511999999999\"`).\n * @returns A tuple of `[maskString, CountryType]`.\n * @throws If the number is invalid or no mask is found for the parsed country.\n *\n * @example\n * ```typescript\n * const [mask, country] = findCountryMask(\"+5511999999999\");\n * // mask: \"(__) _____-____\"\n * // country.name: \"Brazil\"\n * ```\n */\n\nfunction findCountryMask(phoneNumber: string): [string, CountryType] {\n\ttry {\n\t\tconst parsedPhone = parsePhoneNumberWithError(phoneNumber);\n\n\t\tconst countryCode = parsedPhone?.country;\n\t\tif (!countryCode) throw new Error(\"Invalid phone number\");\n\n\t\tconst country = countries.find((c) => c.iso === countryCode);\n\t\tif (!country) throw new Error(\"Phone number country not supported\");\n\n\t\tif (typeof country.mask === \"string\") return [country.mask, country];\n\n\t\tconst maskForLength = country.mask.find((mask) => {\n\t\t\tconst maskDigits = mask.replace(/[^_]/g, \"\");\n\t\t\tconst phoneDigits = removeNonNumeric(parsedPhone.nationalNumber);\n\n\t\t\tconst maskDigitsCount = maskDigits.length;\n\t\t\tconst phoneDigitsCount = phoneDigits.length;\n\n\t\t\treturn maskDigitsCount === phoneDigitsCount;\n\t\t});\n\n\t\tif (!maskForLength) {\n\t\t\tthrow new Error(\"No mask found for the given phone number length\");\n\t\t}\n\n\t\treturn [maskForLength, country];\n\t} catch (rawError) {\n\t\tconst error = rawError as Error;\n\t\tthrow new Error(error.message);\n\t}\n}\n\nexport { findCountryMask };\n","import { parsePhoneNumberWithError } from \"libphonenumber-js\";\nimport { findCountryMask } from \"../utilities/findCountryMask\";\n\n/**\n * Formats a phone number string according to the country mask defined in `@arkyn/templates`.\n *\n * The function parses the input using libphonenumber-js to determine the country and\n * national number, then applies the corresponding country's mask (underscore `_` used\n * as digit placeholder) replacing placeholders with actual digits.\n *\n * @param phoneNumber - The input phone number in E.164 format (e.g. `\"+5534920524282\"`).\n * @returns The phone number formatted according to the country's mask.\n *\n * @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.\n *\n * @example\n * ```typescript\n * console.log(formatToPhone(\"+5534920524282\")); // Output: \"(34) 92052-4282\" (Brazilian format)\n * console.log(formatToPhone(\"+553420524282\")); // Output: \"(34) 2052-4282\" (Brazilian format with optional ninth digit)\n * console.log(formatToPhone(\"+12125550199\")); // Output: \"(212) 555-0199\" (American Samoa format)\n * ```\n */\n\nfunction formatToPhone(phoneNumber: string): string {\n\ttry {\n\t\tconst parsedPhone = parsePhoneNumberWithError(phoneNumber);\n\t\tconst phoneNumberDigits = parsedPhone.nationalNumber.toString();\n\n\t\tlet formattedNumber = findCountryMask(phoneNumber)[0];\n\n\t\tfor (\n\t\t\tlet i = 0, j = 0;\n\t\t\ti < formattedNumber.length && j < phoneNumberDigits.length;\n\t\t\ti++\n\t\t) {\n\t\t\tif (formattedNumber[i] === \"_\") {\n\t\t\t\tformattedNumber =\n\t\t\t\t\tformattedNumber.substring(0, i) +\n\t\t\t\t\tphoneNumberDigits[j] +\n\t\t\t\t\tformattedNumber.substring(i + 1);\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\n\t\treturn formattedNumber;\n\t} catch (rawError) {\n\t\tconst error = rawError as Error;\n\t\tthrow new Error(error.message);\n\t}\n}\n\nexport { formatToPhone };\n","/**\n * Generates a hexadecimal color code based on the input string.\n * The function creates a hash from the string and uses it to calculate\n * RGB values, which are then converted to a hexadecimal color code.\n *\n * @param rawString - The input string used to generate the color.\n * @returns A hexadecimal color code (e.g., `\"#a1b2c3\"`) derived from the input string.\n *\n * @example\n * ```typescript\n * const color = generateColorByString(\"example\");\n * console.log(color); // Outputs a consistent hex color like \"#5e8f9a\"\n * ```\n */\n\nfunction generateColorByString(rawString: string): string {\n\tlet hash = 0;\n\n\tfor (let i = 0; i < rawString.length; i++) {\n\t\thash = rawString.charCodeAt(i) + ((hash << 5) - hash);\n\t}\n\n\tconst red = (hash & 0xff0000) >> 16;\n\tconst green = (hash & 0x00ff00) >> 8;\n\tconst blue = hash & 0x0000ff;\n\n\tconst redHex = red.toString(16).padStart(2, \"0\");\n\tconst greenHex = green.toString(16).padStart(2, \"0\");\n\tconst blueHex = blue.toString(16).padStart(2, \"0\");\n\n\treturn `#${redHex}${greenHex}${blueHex}`;\n}\n\nexport { generateColorByString };\n","function hexToBin(hex: string) {\n\thex = hex.replace(/-/g, \"\");\n\tconst buffer = new Uint8Array(hex.length / 2);\n\n\tfor (let i = 0; i < hex.length; i += 2) {\n\t\tbuffer[i / 2] = parseInt(hex.substring(i, i + 2), 16);\n\t}\n\n\treturn buffer;\n}\n\nfunction uuidV4() {\n\tconst uuid = crypto.randomUUID();\n\treturn { text: uuid, binary: hexToBin(uuid) };\n}\n\nfunction uuidV7() {\n\tconst bytes = crypto.getRandomValues(new Uint8Array(16));\n\n\tconst ts = BigInt(Date.now());\n\n\tbytes[0] = Number((ts >> 40n) & 0xffn);\n\tbytes[1] = Number((ts >> 32n) & 0xffn);\n\tbytes[2] = Number((ts >> 24n) & 0xffn);\n\tbytes[3] = Number((ts >> 16n) & 0xffn);\n\tbytes[4] = Number((ts >> 8n) & 0xffn);\n\tbytes[5] = Number(ts & 0xffn);\n\n\t// versão 7\n\tbytes[6] = (bytes[6] & 0x0f) | 0x70;\n\n\t// variante RFC 4122\n\tbytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n\tconst uuid = [...bytes]\n\t\t.map((b) => b.toString(16).padStart(2, \"0\"))\n\t\t.join(\"\")\n\t\t.replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, \"$1-$2-$3-$4-$5\");\n\n\treturn {\n\t\ttext: uuid,\n\t\tbinary: hexToBin(uuid),\n\t};\n}\n\n/**\n * Generates a UUID in the specified version and output type.\n *\n * @param type - Output representation: `\"text\"` (string) or `\"binary\"` (`Uint8Array`).\n * @param format - UUID version: `\"v4\"` (random) or `\"v7\"` (time-ordered).\n * @returns The UUID as a string or `Uint8Array` depending on `type`.\n *\n * @example\n * ```typescript\n * generateId(\"text\", \"v4\"); // \"550e8400-e29b-41d4-a716-446655440000\"\n * generateId(\"binary\", \"v7\"); // Uint8Array([...])\n * ```\n */\nfunction generateId(type: \"text\", format: \"v4\" | \"v7\"): string;\nfunction generateId(type: \"binary\", format: \"v4\" | \"v7\"): Uint8Array;\nfunction generateId(\n\ttype: \"text\" | \"binary\",\n\tformat: \"v4\" | \"v7\",\n): string | Uint8Array {\n\tif (type === \"text\" && format === \"v4\") return uuidV4().text;\n\tif (type === \"binary\" && format === \"v4\") return uuidV4().binary;\n\tif (type === \"text\" && format === \"v7\") return uuidV7().text;\n\tif (type === \"binary\" && format === \"v7\") return uuidV7().binary;\n\tthrow new Error(\"Invalid type or format\");\n}\n\nexport { generateId };\n","/**\n * Generates a URL-friendly slug from a given string.\n *\n * The function performs the following transformations:\n * - Normalizes the string to remove diacritical marks (e.g., accents).\n * - Removes non-alphanumeric characters except for spaces and hyphens.\n * - Replaces spaces with hyphens.\n * - Converts the string to lowercase.\n * - Collapses multiple consecutive hyphens into a single hyphen.\n * - Trims leading and trailing hyphens.\n *\n * @param rawString - The input string to be converted into a slug.\n * @returns A URL-friendly slug derived from the input string.\n *\n * @example\n * ```typescript\n * const slug = generateSlug(\"Hello, World! This is a Test.\");\n * console.log(slug); // Outputs: \"hello-world-this-is-a-test\"\n * ```\n */\n\nfunction generateSlug(rawString: string): string {\n\tlet slug = rawString.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n\n\tslug = slug\n\t\t.replace(/[^\\w\\s-]/g, \"\")\n\t\t.replace(/\\s+/g, \"-\")\n\t\t.toLowerCase();\n\n\tslug = slug.replace(/-{2,}/g, \"-\");\n\n\tslug = slug.replace(/^-+|-+$/g, \"\");\n\n\treturn slug;\n}\n\nexport { generateSlug };\n","/**\n * Truncates large string fields in a JSON string to a specified maximum length.\n *\n * This function parses a JSON string, traverses its structure recursively, and truncates\n * any string fields that exceed the specified maximum length. If a string field is truncated,\n * it is replaced with a message indicating the original length of the field.\n *\n * @param jsonString - The JSON string to process.\n * @param maxLength - The maximum allowed length for string fields. Defaults to 1000.\n * @returns A JSON string with large string fields truncated.\n *\n * @throws {Error} Throws an error if the input is not a valid JSON string.\n *\n * @example\n * ```typescript\n * const json = JSON.stringify({\n * name: \"John\",\n * description: \"A very long description that exceeds the maximum length...\",\n * nested: { details: \"Another long string that needs truncation.\" }\n * });\n *\n * const result = parseLargeFields(json, 50);\n * console.log(result);\n * // Output: '{\"name\":\"John\",\"description\":\"To large information: field as 57 characters\",\"nested\":{\"details\":\"To large information: field as 43 characters\"}}'\n * ```\n */\n\nfunction parseLargeFields(\n\tjsonString: string,\n\tmaxLength: number = 1000,\n): string {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction truncateValue(value: any): any {\n\t\tif (typeof value === \"string\" && value.length > maxLength) {\n\t\t\treturn `To large information: field as ${value.length} characters`;\n\t\t}\n\t\treturn value;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction recursiveTruncate(obj: any): any {\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => recursiveTruncate(item));\n\t\t} else if (obj !== null && typeof obj === \"object\") {\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries(obj).map(([key, value]) => [\n\t\t\t\t\tkey,\n\t\t\t\t\trecursiveTruncate(value),\n\t\t\t\t]),\n\t\t\t);\n\t\t}\n\t\treturn truncateValue(obj);\n\t}\n\n\ttry {\n\t\tconst parsedJson = JSON.parse(jsonString);\n\t\tconst truncatedJson = recursiveTruncate(parsedJson);\n\t\treturn JSON.stringify(truncatedJson);\n\t} catch (_error) {\n\t\tthrow new Error(\"Invalid JSON string\");\n\t}\n}\n\nexport { parseLargeFields };\n","/**\n * Masks sensitive data in a JSON string by replacing the values of specified keys with \"****\".\n *\n * @param jsonString - The JSON string to be processed.\n * @param sensitiveKeys - Keys whose values will be replaced with `\"****\"`. Defaults to `[\"password\", \"confirmPassword\", \"creditCard\"]`.\n * @returns A JSON string with sensitive values masked. Returns the original string if it is not valid JSON.\n *\n * @example\n * ```typescript\n * const jsonString = JSON.stringify({\n * username: \"user123\",\n * password: \"secret\",\n * profile: { creditCard: \"1234-5678-9012-3456\" },\n * });\n *\n * const result = parseSensitiveData(jsonString, [\"password\", \"creditCard\"]);\n * console.log(result); // Output: '{\"username\":\"user123\",\"password\":\"****\",\"profile\":{\"creditCard\":\"****\"}}'\n * ```\n */\n\nfunction parseSensitiveData(\n\tjsonString: string,\n\tsensitiveKeys: string[] = [\"password\", \"confirmPassword\", \"creditCard\"],\n): string {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction maskValue(key: string, value: any): any {\n\t\tif (sensitiveKeys.includes(key)) return \"****\";\n\t\treturn value;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction recursiveMask(obj: any): any {\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => recursiveMask(item));\n\t\t} else if (obj !== null && typeof obj === \"object\") {\n\t\t\treturn Object.keys(obj).reduce(\n\t\t\t\t(acc, key) => {\n\t\t\t\t\tlet value = obj[key];\n\t\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst parsedValue = JSON.parse(value);\n\t\t\t\t\t\t\tif (typeof parsedValue === \"object\") {\n\t\t\t\t\t\t\t\tvalue = JSON.stringify(recursiveMask(parsedValue));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (_e) {}\n\t\t\t\t\t}\n\t\t\t\t\tacc[key] = recursiveMask(maskValue(key, value));\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{} as Record<string, unknown>,\n\t\t\t);\n\t\t}\n\t\treturn obj;\n\t}\n\n\ttry {\n\t\tconst jsonObject = JSON.parse(jsonString);\n\t\tconst maskedObject = recursiveMask(jsonObject);\n\t\treturn JSON.stringify(maskedObject);\n\t} catch (_error) {\n\t\treturn jsonString;\n\t}\n}\n\nexport { parseSensitiveData };\n","import { ValidateDateService } from \"../services/validateDateService\";\n\n/**\n * Parses a date (and optional time) string into a JavaScript `Date` object.\n * All calculations are in UTC+0; use `timezone` to shift the result.\n *\n * @param date - Date string in the format determined by `inputFormat`.\n * @param time - Optional time string `\"HH:mm:ss\"` (defaults to `\"00:00:00\"`).\n * @param inputFormat - Parsing format:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"isoDate\"`: MM-DD-YYYY\n * - `\"timestamp\"`: YYYY-MM-DD\n * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.\n * @returns A `Date` object representing the parsed date and time.\n *\n * @example\n * ```typescript\n * parseToDate([\"25/12/2023\", \"15:30:00\"], \"brazilianDate\", -3);\n * // Date: 2023-12-25T12:30:00.000Z\n *\n * parseToDate([\"2023-12-25\"], \"timestamp\");\n * // Date: 2023-12-25T00:00:00.000Z\n * ```\n */\n\nfunction parseToDate(\n\t[date, time = \"00:00:00\"]: string[],\n\tinputFormat: \"brazilianDate\" | \"isoDate\" | \"timestamp\",\n\ttimezone: number = 0,\n): Date {\n\tconst validateDateService = new ValidateDateService();\n\tvalidateDateService.validateInputFormat(inputFormat);\n\n\tconst dateParts = date.split(/[-/]/).map(Number);\n\tconst timeParts = time.split(\".\")[0].split(\":\").map(Number);\n\n\tlet day: number, month: number, year: number;\n\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\n\tswitch (inputFormat) {\n\t\tcase \"brazilianDate\":\n\t\t\t[day, month, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"isoDate\":\n\t\t\t[month, day, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"timestamp\":\n\t\t\t[year, month, day] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t}\n\n\tconst formattedDate = new Date(\n\t\tDate.UTC(year, month - 1, day, hours, minutes, seconds),\n\t);\n\n\tif (Number.isNaN(formattedDate.getTime())) throw new Error(\"Invalid date\");\n\n\tformattedDate.setUTCHours(formattedDate.getUTCHours() + timezone);\n\n\treturn formattedDate;\n}\n\nexport { parseToDate };\n","/**\n * Calculates the per-installment and total price for a card payment plan with compound interest.\n * No interest is applied when `fees` is `0` or `numberInstallments` is `1`.\n *\n * @param props.cashPrice - The base price of the item.\n * @param props.numberInstallments - Number of installments (must be > 0).\n * @param props.fees - Monthly interest rate (defaults to `0.0349`).\n * @returns `{ totalPrice, installmentPrice }` — both rounded to 2 decimal places.\n *\n * @example\n * ```typescript\n * calculateCardInstallment({ cashPrice: 1000, numberInstallments: 12, fees: 0.02 });\n * // { totalPrice: 1124.62, installmentPrice: 93.72 }\n * ```\n */\n\nfunction calculateCardInstallment(props: {\n\tcashPrice: number;\n\tnumberInstallments: number;\n\tfees?: number;\n}): { totalPrice: number; installmentPrice: number } {\n\tconst { cashPrice, numberInstallments, fees = 0.0349 } = props;\n\n\tif (fees === 0 || numberInstallments === 1) {\n\t\treturn {\n\t\t\ttotalPrice: cashPrice,\n\t\t\tinstallmentPrice: cashPrice / numberInstallments,\n\t\t};\n\t}\n\n\tif (numberInstallments <= 0) {\n\t\tthrow new Error(\"Number of installments must be greater than 0\");\n\t}\n\n\tif (fees < 0) {\n\t\tthrow new Error(\"Fees must be greater than or equal to 0\");\n\t}\n\n\tconst numerator = (1 + fees) ** numberInstallments * fees;\n\tconst denominator = (1 + fees) ** numberInstallments - 1;\n\n\tconst installmentPrice = +(cashPrice * (numerator / denominator)).toFixed(2);\n\tconst totalPrice = +(installmentPrice * numberInstallments).toFixed(2);\n\n\treturn {\n\t\ttotalPrice: +totalPrice.toFixed(2),\n\t\tinstallmentPrice: +installmentPrice.toFixed(2),\n\t};\n}\n\nexport { calculateCardInstallment };\n","/**\n * Ensures that a given rawValue string is enclosed in quotes.\n *\n * This function checks if the input string is already enclosed in either single\n * quotes (`'`) or double quotes (`\"`). If the string is already quoted, it is\n * returned as-is. Otherwise, the function wraps the string in double quotes.\n *\n * @param rawValue - The string to be checked and potentially quoted.\n * @returns The original string if already quoted, otherwise the string wrapped in double quotes.\n *\n * @example\n * ```typescript\n * ensureQuotes('example'); // Returns: '\"example\"'\n * ensureQuotes('\"already quoted\"'); // Returns: '\"already quoted\"'\n * ensureQuotes(\"'single quoted'\"); // Returns: \"'single quoted'\"\n * ```\n */\n\nfunction ensureQuotes(rawValue: string): string {\n\tconst hasSingleQuotes = rawValue.startsWith(\"'\") && rawValue.endsWith(\"'\");\n\tconst hasDoubleQuotes = rawValue.startsWith('\"') && rawValue.endsWith('\"');\n\n\tif (hasSingleQuotes || hasDoubleQuotes) {\n\t\treturn rawValue;\n\t}\n\n\treturn `\"${rawValue}\"`;\n}\n\nexport { ensureQuotes };\n","/**\n * Check if a string contains HTML markup.\n *\n * This function uses a regular expression to detect the presence of HTML tags\n * in a string. The check is case-insensitive and detects both opening\n * and closing tags.\n *\n * @param rawString - The string to check.\n * @returns `true` if the string contains HTML markup, `false` otherwise.\n *\n * @example\n * ```typescript\n * isHtml('<p>Hello world</p>'); // true\n * isHtml('<div>Content</div>'); // true\n * isHtml('Plain text'); // false\n * isHtml(''); // false\n * ```\n */\n\nfunction isHtml(rawString: string): boolean {\n\tconst htmlRegex = /<\\/?[a-z][\\s\\S]*>/i;\n\treturn htmlRegex.test(rawString);\n}\n\nexport { isHtml };\n","/**\n * Strips HTML tags from a string.\n *\n * This function removes all HTML tags from the provided string by replacing any content\n * that matches the HTML tag pattern with an empty string.\n *\n * @param rawHtml - The HTML string to strip tags from.\n * @returns The plain text with all HTML tags (including `<script>`, `<style>`, and comments) removed.\n *\n * @example\n * ```typescript\n * const strippedHtml = stripHtmlTags(\"<p>Hello <strong>World</strong></p>\");\n * console.log(strippedHtml); // \"Hello World\"\n * ```\n */\n\nfunction stripHtmlTags(rawHtml: string): string {\n\treturn rawHtml\n\t\t.replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi, \"\")\n\t\t.replace(/<style\\b[^<]*(?:(?!<\\/style>)<[^<]*)*<\\/style>/gi, \"\")\n\t\t.replace(/<!--[\\s\\S]*?-->/g, \"\")\n\t\t.replace(/<\\/?[a-z][a-z0-9]*[^>]*>/gi, \"\");\n}\n\nexport { stripHtmlTags };\n"],"mappings":";;;AAcA,IAAM,IAAN,MAA0B;CACzB,WAAmB,GAAuB;EACzC,OAAQ,IAAO,KAAM,KAAK,IAAO,OAAQ,KAAM,IAAO,OAAQ;CAC/D;CAEA,eAAuB,GAAe,GAAsB;EAG3D,OADI,MAAU,KAAK,KAAK,WAAW,CAAI,IAAU,KAC1C;GAFc;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAE1D,CAAA,CA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,EAAE,MAHR,IAAI,MAAS,IAAqB,MAChC,IAAI,MAAS,IAAqB,IAAA,CAEW,QAAQ,CAAC;CAG3E,OAAO;EACN,YAAY,EAAC,EAHO,IAAmB,EAAA,CAAoB,QAAQ,CAAC,EAAA,CAG5C,QAAQ,CAAC;EACjC,kBAAkB,CAAC,EAAiB,QAAQ,CAAC;CAC9C;AACD;;;AC9BA,SAAS,EAAa,GAA0B;CAC/C,IAAM,IAAkB,EAAS,WAAW,GAAG,KAAK,EAAS,SAAS,GAAG,GACnE,IAAkB,EAAS,WAAW,IAAG,KAAK,EAAS,SAAS,IAAG;CAMzE,OAJI,KAAmB,IACf,IAGD,IAAI,EAAS;AACrB;;;ACRA,SAAS,EAAO,GAA4B;CAE3C,OAAO,qBAAU,KAAK,CAAS;AAChC;;;ACNA,SAAS,EAAc,GAAyB;CAC/C,OAAO,EACL,QAAQ,uDAAuD,EAAE,CAAC,CAClE,QAAQ,oDAAoD,EAAE,CAAC,CAC/D,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,8BAA8B,EAAE;AAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatDate.js","names":[],"sources":["../../../src/formats/formatDate.ts"],"sourcesContent":["import { ValidateDateService } from \"../services/validateDateService\";\n\nfunction formatDateString(date: Date, format: string): string {\n\tconst pad = (num: number) => num.toString().padStart(2, \"0\");\n\n\tconst replacements: Record<string, string> = {\n\t\tYYYY: date.getUTCFullYear().toString(),\n\t\tYY: date.getUTCFullYear().toString().slice(-2),\n\t\tMM: pad(date.getUTCMonth() + 1),\n\t\tDD: pad(date.getUTCDate()),\n\t\thh: pad(date.getUTCHours()),\n\t\tmm: pad(date.getUTCMinutes()),\n\t\tss: pad(date.getUTCSeconds()),\n\t};\n\n\treturn format.replace(\n\t\t/YYYY|YY|MM|DD|hh|mm|ss/g,\n\t\t(match) => replacements[match],\n\t);\n}\n\n/**\n * Formats a date (and optional time) string into a custom output format.\n * All calculations are in UTC+0; use the `timezone` parameter to shift the result.\n *\n * @param date - Date string in the format determined by `inputFormat`.\n * @param time - Optional time string `\"HH:mm:ss\"` (defaults to `\"00:00:00\"`).\n * @param inputFormat - Parsing format:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"isoDate\"`: MM-DD-YYYY\n * - `\"timestamp\"`: YYYY-MM-DD\n * @param outputFormat - Output template using `YYYY`, `MM`, `DD`, `hh`, `mm`, `ss` placeholders.\n * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.\n * @returns The formatted date string.\n *\n * @example\n * ```typescript\n * formatDate([\"25/12/2023\", \"15:30:00\"], \"brazilianDate\", \"YYYY-MM-DD hh:mm\");\n * // \"2023-12-25 15:30\"\n *\n * formatDate([\"2023-12-25\", \"15:30:00\"], \"timestamp\", \"DD/MM/YYYY hh:mm\", -3);\n * // \"2023-12-25 12:30\"\n * ```\n */\n\nfunction formatDate(\n\t[date, time = \"00:00:00\"]: string[],\n\tinputFormat: \"brazilianDate\" | \"isoDate\" | \"timestamp\",\n\toutputFormat: string,\n\ttimezone: number = 0,\n): string {\n\tconst validateDateService = new ValidateDateService();\n\tvalidateDateService.validateInputFormat(inputFormat);\n\n\tconst dateParts = date.split(/[-/]/).map(Number);\n\tconst timeParts = time.split(\".\")[0].split(\":\").map(Number);\n\n\tlet day: number, month: number, year: number;\n\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\n\tswitch (inputFormat) {\n\t\tcase \"brazilianDate\":\n\t\t\t[day, month, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"isoDate\":\n\t\t\t[month, day, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"timestamp\":\n\t\t\t[year, month, day] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t}\n\n\tconst formattedDate = new Date(\n\t\tDate.UTC(year, month - 1, day, hours, minutes, seconds),\n\t);\n\n\tif (Number.isNaN(formattedDate.getTime())) throw new Error(\"Invalid date\");\n\n\tformattedDate.setUTCHours(formattedDate.getUTCHours() + timezone);\n\n\treturn formatDateString(formattedDate, outputFormat);\n}\n\nexport { formatDate };\n"],"mappings":";;AAEA,SAAS,EAAiB,GAAY,GAAwB;CAC7D,IAAM,KAAO,MAAgB,EAAI,SAAS,CAAC,CAAC,SAAS,GAAG,GAAG,GAErD,IAAuC;EAC5C,MAAM,EAAK,eAAe,CAAC,CAAC,SAAS;EACrC,IAAI,EAAK,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;EAC7C,IAAI,EAAI,EAAK,YAAY,IAAI,CAAC;EAC9B,IAAI,EAAI,EAAK,WAAW,CAAC;EACzB,IAAI,EAAI,EAAK,YAAY,CAAC;EAC1B,IAAI,EAAI,EAAK,cAAc,CAAC;EAC5B,IAAI,EAAI,EAAK,cAAc,CAAC;CAC7B;CAEA,OAAO,EAAO,QACb,4BACC,MAAU,EAAa,EACzB;AACD;AA0BA,SAAS,EACR,CAAC,GAAM,IAAO,aACd,GACA,GACA,IAAmB,GACV;CACT,IAAM,IAAsB,IAAI,EAAoB;CACpD,EAAoB,oBAAoB,CAAW;CAEnD,IAAM,IAAY,EAAK,MAAM,MAAM,CAAC,CAAC,IAAI,MAAM,GACzC,IAAY,EAAK,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,GAEtD,GAAa,GAAe,GAC1B,CAAC,IAAQ,GAAG,IAAU,GAAG,IAAU,KAAK;CAE9C,QAAQ,GAAR;EACC,KAAK;GAEJ,AADA,CAAC,GAAK,GAAO,KAAQ,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;EACD,KAAK;GAEJ,AADA,CAAC,GAAO,GAAK,KAAQ,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;EACD,KAAK;GAEJ,AADA,CAAC,GAAM,GAAO,KAAO,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;CACF;CAEA,IAAM,IAAgB,IAAI,KACzB,KAAK,IAAI,GAAM,IAAQ,GAAG,GAAK,GAAO,GAAS,CAAO,CACvD;CAEA,IAAI,OAAO,MAAM,EAAc,QAAQ,CAAC,GAAG,MAAU,MAAM,cAAc;CAIzE,OAFA,EAAc,YAAY,EAAc,YAAY,IAAI,CAAQ,GAEzD,EAAiB,GAAe,CAAY;AACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatJsonObject.js","names":[],"sources":["../../../src/formats/formatJsonObject.ts"],"sourcesContent":["/**\n * Formats a JSON object into a human-readable string with proper indentation.\n *\n * - If the input is an object, it will be formatted with keys and values properly indented.\n * - If the input is an array, each element will be formatted and indented on a new line.\n * - If the input is a string that can be parsed as JSON, it will attempt to parse and format it.\n * - Primitive values (e.g., numbers, booleans, null) will be converted to their string representation.\n *\n * @param json - The value to format: object, array, string, or primitive.\n * @param indentLevel - Current indentation depth (used recursively; pass `0` at the top level).\n * @returns A pretty-printed string representation of the value.\n *\n * @example\n * ```typescript\n * const obj = { name: \"John\", age: 30, hobbies: [\"reading\", \"gaming\"] };\n * const formatted = formatJsonObject(obj, 0);\n * console.log(formatted);\n * // Output:\n * // {\n * // \"name\": \"John\",\n * // \"age\": 30,\n * // \"hobbies\": [\n * // \"reading\",\n * // \"gaming\"\n * // ]\n * // }\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nconst formatJsonObject = (json: any, indentLevel: number): string => {\n\tconst indent = \" \".repeat(indentLevel);\n\tlet formattedString = \"\";\n\n\tif (typeof json === \"object\" && json !== null) {\n\t\tif (Array.isArray(json)) {\n\t\t\tif (json.length === 0) {\n\t\t\t\t// Caso especial para arrays vazios\n\t\t\t\tformattedString += \"[]\";\n\t\t\t} else {\n\t\t\t\tformattedString += \"[\\n\";\n\t\t\t\tjson.forEach((item, index) => {\n\t\t\t\t\tformattedString += `${indent} ${formatJsonObject(item, indentLevel + 1)}`;\n\t\t\t\t\tif (index < json.length - 1) {\n\t\t\t\t\t\tformattedString += \",\";\n\t\t\t\t\t}\n\t\t\t\t\tformattedString += \"\\n\";\n\t\t\t\t});\n\t\t\t\tformattedString += `${indent}]`;\n\t\t\t}\n\t\t} else {\n\t\t\tconst keys = Object.keys(json);\n\t\t\tif (keys.length === 0) {\n\t\t\t\t// Caso especial para objetos vazios\n\t\t\t\tformattedString += \"{}\";\n\t\t\t} else {\n\t\t\t\tformattedString += \"{\\n\";\n\t\t\t\tkeys.forEach((key, index) => {\n\t\t\t\t\tformattedString +=\n\t\t\t\t\t\tindent +\n\t\t\t\t\t\t' \"' +\n\t\t\t\t\t\tkey +\n\t\t\t\t\t\t'\": ' +\n\t\t\t\t\t\tformatJsonObject(json[key], indentLevel + 1);\n\t\t\t\t\tif (index < keys.length - 1) {\n\t\t\t\t\t\tformattedString += \",\";\n\t\t\t\t\t}\n\t\t\t\t\tformattedString += \"\\n\";\n\t\t\t\t});\n\t\t\t\tformattedString += `${indent}}`;\n\t\t\t}\n\t\t}\n\t} else if (typeof json === \"string\") {\n\t\ttry {\n\t\t\tconst parsedObj = JSON.parse(json);\n\t\t\tformattedString += formatJsonObject(parsedObj, indentLevel);\n\t\t} catch {\n\t\t\tformattedString += `\"${json}\"`;\n\t\t}\n\t} else {\n\t\tformattedString += json;\n\t}\n\n\treturn formattedString;\n};\n\nexport { formatJsonObject };\n"],"mappings":";AA8BA,IAAM,KAAoB,GAAW,MAAgC;CACpE,IAAM,IAAS,KAAK,OAAO,CAAW,GAClC,IAAkB;CAEtB,IAAI,OAAO,KAAS,YAAY,GAC/B,IAAI,MAAM,QAAQ,CAAI,GACrB,AAAI,EAAK,WAAW,IAEnB,KAAmB,QAEnB,KAAmB,OACnB,EAAK,SAAS,GAAM,MAAU;EAK7B,AAJA,KAAmB,GAAG,EAAO,IAAI,EAAiB,GAAM,IAAc,CAAC,KACnE,IAAQ,EAAK,SAAS,MACzB,KAAmB,MAEpB,KAAmB;CACpB,CAAC,GACD,KAAmB,GAAG,EAAO;MAExB;EACN,IAAM,IAAO,OAAO,KAAK,CAAI;EAC7B,AAAI,EAAK,WAAW,IAEnB,KAAmB,QAEnB,KAAmB,OACnB,EAAK,SAAS,GAAK,MAAU;GAU5B,AATA,KACC,IACA,SACA,IACA,SACA,EAAiB,EAAK,IAAM,IAAc,CAAC,GACxC,IAAQ,EAAK,SAAS,MACzB,KAAmB,MAEpB,KAAmB;EACpB,CAAC,GACD,KAAmB,GAAG,EAAO;CAE/B;MACM,IAAI,OAAO,KAAS,UAC1B,IAAI;EACH,IAAM,IAAY,KAAK,MAAM,CAAI;EACjC,KAAmB,EAAiB,GAAW,CAAW;CAC3D,QAAQ;EACP,KAAmB,IAAI,EAAK;CAC7B;MAEA,KAAmB;CAGpB,OAAO;AACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatJsonString.js","names":[],"sources":["../../../src/formats/formatJsonString.ts"],"sourcesContent":["import { formatJsonObject } from \"./formatJsonObject\";\n\ntype FormatJsonStringFunction = (jsonString: string) => string;\n\n/**\n * Parses a JSON string and returns a human-readable pretty-printed representation.\n * Throws if the input is not valid JSON.\n *\n * @param jsonString - A valid JSON string to format.\n * @returns A pretty-printed string representation.\n *\n * @example\n * ```typescript\n * formatJsonString('{\"name\":\"John\",\"hobbies\":[\"reading\",\"gaming\"]}');\n * // {\n * // \"name\": \"John\",\n * // \"hobbies\": [\n * // \"reading\",\n * // \"gaming\"\n * // ]\n * // }\n * ```\n */\n\nconst formatJsonString: FormatJsonStringFunction = (jsonString) => {\n\ttry {\n\t\tconst jsonObject = JSON.parse(jsonString);\n\t\treturn formatJsonObject(jsonObject, 0);\n\t} catch (error) {\n\t\tthrow new Error(`Invalid JSON string \\n ${error}`);\n\t}\n};\n\nexport { formatJsonString };\n"],"mappings":";;AAwBA,IAAM,KAA8C,MAAe;CAClE,IAAI;EAEH,OAAO,EADY,KAAK,MAAM,CACN,GAAY,CAAC;CACtC,SAAS,GAAO;EACf,MAAU,MAAM,0BAA0B,GAAO;CAClD;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCapitalizeFirstWordLetter.js","names":[],"sources":["../../../src/formats/formatToCapitalizeFirstWordLetter.ts"],"sourcesContent":["/**\n * Capitalizes the first letter of each word and lowercases the rest.\n * Words are separated by spaces.\n *\n * @param sentence - The string to format.\n * @returns The sentence with every word title-cased.\n *\n * @example\n * ```typescript\n * formatToCapitalizeFirstWordLetter(\"hello world\"); // \"Hello World\"\n * formatToCapitalizeFirstWordLetter(\"HELLO WORLD\"); // \"Hello World\"\n * ```\n */\n\nfunction formatToCapitalizeFirstWordLetter(sentence: string) {\n\tconst words = sentence.split(\" \");\n\n\tconst capitalizedWords = words.map((word) => {\n\t\tconst firstLetter = word.charAt(0).toUpperCase();\n\t\tconst restOfWord = word.slice(1).toLowerCase();\n\t\treturn firstLetter + restOfWord;\n\t});\n\n\treturn capitalizedWords.join(\" \");\n}\n\nexport { formatToCapitalizeFirstWordLetter };\n"],"mappings":";AAcA,SAAS,EAAkC,GAAkB;CAS5D,OARc,EAAS,MAAM,GAEJ,CAAA,CAAM,KAAK,MACf,EAAK,OAAO,CAAC,CAAC,CAAC,YAE5B,IADY,EAAK,MAAM,CAAC,CAAC,CAAC,YACZ,CAGf,CAAA,CAAiB,KAAK,GAAG;AACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCep.js","names":[],"sources":["../../../src/formats/formatToCep.ts"],"sourcesContent":["import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string into a Brazilian postal code (CEP) format.\n *\n * The function removes all non-numeric characters from the input string\n * and attempts to format it as a CEP in the pattern `XXXXX-XXX`.\n * If the input does not match the expected format, an error is thrown.\n *\n * @param value - Input string with 8 numeric digits (special characters are stripped).\n * @returns The formatted CEP string in the pattern `XXXXX-XXX`.\n *\n * @throws {Error} If the input does not match the expected CEP format.\n *\n * @example\n * ```typescript\n * const formattedCep = formatToCep(\"12345678\");\n * console.log(formattedCep); // Output: \"12345-678\"\n * ```\n */\n\nfunction formatToCep(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{5})(\\d{3})$/);\n\n\tconst errorMessage = `CEP must be contain 8 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}-${match[2]}`;\n}\n\nexport { formatToCep };\n"],"mappings":";;AAqBA,SAAS,EAAY,GAAuB;CAE3C,IAAM,IADU,EAAiB,CACnB,CAAA,CAAQ,MAAM,kBAAkB,GAExC,IAAe,yCAAyC;CAC9D,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM;AAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCnpj.js","names":[],"sources":["../../../src/formats/formatToCnpj.ts"],"sourcesContent":["import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.\n *\n * The CNPJ format is: `XX.XXX.XXX/XXXX-XX`, where `X` represents a digit.\n *\n * @param value - Input string with 14 numeric digits (special characters are stripped).\n * @returns The formatted CNPJ string in the pattern `XX.XXX.XXX/XXXX-XX`.\n *\n * @throws {Error} Throws an error if the input does not contain exactly 14 numeric digits.\n *\n * @example\n * ```typescript\n * const formattedCnpj = formatToCnpj(\"12345678000195\");\n * console.log(formattedCnpj); // Output: \"12.345.678/0001-95\"\n * ```\n */\n\nfunction formatToCnpj(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})$/);\n\n\tconst errorMessage = `CNPJ must be contain 14 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}.${match[2]}.${match[3]}/${match[4]}-${match[5]}`;\n}\n\nexport { formatToCnpj };\n"],"mappings":";;AAmBA,SAAS,EAAa,GAAuB;CAE5C,IAAM,IADU,EAAiB,CACnB,CAAA,CAAQ,MAAM,uCAAuC,GAE7D,IAAe,2CAA2C;CAChE,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM;AACjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCpf.js","names":[],"sources":["../../../src/formats/formatToCpf.ts"],"sourcesContent":["import { removeNonNumeric } from \"../utilities/removeNonNumeric\";\n\n/**\n * Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.\n *\n * A CPF is a Brazilian individual taxpayer registry identification format.\n * This function ensures the input is cleaned of non-numeric characters and\n * then formats it into the standard CPF format: `XXX.XXX.XXX-XX`.\n *\n * @param value - Input string with 11 numeric digits (special characters are stripped).\n * @returns The formatted CPF string in the pattern `XXX.XXX.XXX-XX`.\n *\n * @throws {Error} If the input string does not match the expected CPF format.\n *\n * @example\n * ```typescript\n * const formattedCpf = formatToCpf(\"12345678909\");\n * console.log(formattedCpf); // Output: \"123.456.789-09\"\n * ```\n */\n\nfunction formatToCpf(value: string): string {\n\tconst cleaned = removeNonNumeric(value);\n\tconst match = cleaned.match(/^(\\d{3})(\\d{3})(\\d{3})(\\d{2})$/);\n\n\tconst errorMessage = `CPF must be contain 11 numeric digits: ${value}`;\n\tif (!match) throw new Error(errorMessage);\n\n\treturn `${match[1]}.${match[2]}.${match[3]}-${match[4]}`;\n}\n\nexport { formatToCpf };\n"],"mappings":";;AAqBA,SAAS,EAAY,GAAuB;CAE3C,IAAM,IADU,EAAiB,CACnB,CAAA,CAAQ,MAAM,gCAAgC,GAEtD,IAAe,0CAA0C;CAC/D,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM;AACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCurrency.js","names":[],"sources":["../../../src/formats/formatToCurrency.ts"],"sourcesContent":["import { countryCurrencies } from \"@arkyn/templates\";\nimport { removeCurrencySymbols } from \"../utilities/removeCurrencySymbols\";\n\ntype Currencies = keyof typeof countryCurrencies;\n\n/**\n * Formats a number into a locale-aware currency string using `Intl.NumberFormat`.\n *\n * @param value - The numeric value to format.\n * @param currency - A currency code from `@arkyn/templates` (e.g. `\"BRL\"`, `\"USD\"`).\n * @param config.showPrefix - Whether to include the currency symbol. Defaults to `true`.\n * @returns The formatted currency string.\n *\n * @example\n * ```typescript\n * formatToCurrency(1234.56, \"BRL\"); // \"R$ 1.234,56\"\n * formatToCurrency(1234.56, \"USD\", { showPrefix: false }); // \"1,234.56\"\n * ```\n */\nfunction formatToCurrency(\n\tvalue: number,\n\tcurrency: Currencies,\n\tconfig?: { showPrefix?: boolean },\n): string {\n\tif (!countryCurrencies?.[currency]) {\n\t\tthrow new Error(\"Unsupported currency code\");\n\t}\n\n\tconst showPrefix = config?.showPrefix ?? true;\n\n\tconst { countryCurrency, countryLanguage } = countryCurrencies[currency];\n\n\tconst format = new Intl.NumberFormat(countryLanguage, {\n\t\tstyle: \"currency\",\n\t\tcurrency: countryCurrency,\n\t}).format(value);\n\n\treturn showPrefix\n\t\t? format.replace(/\\s/g, \" \")\n\t\t: removeCurrencySymbols(format).replace(/\\s/g, \" \");\n}\n\nexport { formatToCurrency };\n"],"mappings":";;;AAmBA,SAAS,EACR,GACA,GACA,GACS;CACT,IAAI,CAAC,IAAoB,IACxB,MAAU,MAAM,2BAA2B;CAG5C,IAAM,IAAa,GAAQ,cAAc,IAEnC,EAAE,oBAAiB,uBAAoB,EAAkB,IAEzD,IAAS,IAAI,KAAK,aAAa,GAAiB;EACrD,OAAO;EACP,UAAU;CACX,CAAC,CAAC,CAAC,OAAO,CAAK;CAEf,OAAO,IACJ,EAAO,QAAQ,OAAO,GAAG,IACzB,EAAsB,CAAM,CAAC,CAAC,QAAQ,OAAO,GAAG;AACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToEllipsis.js","names":[],"sources":["../../../src/formats/formatToEllipsis.ts"],"sourcesContent":["/**\n * Truncates a given text to a specified maximum length and appends an ellipsis (\"...\")\n * if the text exceeds the maximum length.\n *\n * @param text - The input string to be truncated.\n * @param maxLength - Maximum allowed length before truncation.\n * @returns The truncated string with `\"...\"` appended, or the original string if it fits.\n * @example\n * ```typescript\n * const result = formatToEllipsis(\"Hello, world!\", 5);\n * console.log(result); // Output: \"Hello...\"\n * ```\n */\n\nfunction formatToEllipsis(text: string, maxLength: number): string {\n\tif (text.length > maxLength) {\n\t\tlet trimmedText = text.substring(0, maxLength);\n\n\t\t// Find the last space to avoid breaking words\n\t\tconst lastSpaceIndex = trimmedText.lastIndexOf(\" \");\n\t\tif (lastSpaceIndex > 0) {\n\t\t\ttrimmedText = trimmedText.substring(0, lastSpaceIndex);\n\t\t}\n\n\t\t// Remove trailing punctuation\n\t\ttrimmedText = trimmedText.replace(/[\\s.,!?;:]+$/, \"\");\n\n\t\t// If after removing punctuation the text is empty or only contains punctuation/spaces, return only \"...\"\n\t\tif (trimmedText.trim().length === 0 || /^[.,!?;:\\s]+$/.test(trimmedText)) {\n\t\t\treturn \"...\";\n\t\t}\n\n\t\treturn `${trimmedText}...`;\n\t}\n\n\treturn text;\n}\n\nexport { formatToEllipsis };\n"],"mappings":";AAcA,SAAS,EAAiB,GAAc,GAA2B;CAClE,IAAI,EAAK,SAAS,GAAW;EAC5B,IAAI,IAAc,EAAK,UAAU,GAAG,CAAS,GAGvC,IAAiB,EAAY,YAAY,GAAG;EAalD,OAZI,IAAiB,MACpB,IAAc,EAAY,UAAU,GAAG,CAAc,IAItD,IAAc,EAAY,QAAQ,gBAAgB,EAAE,GAGhD,EAAY,KAAK,CAAC,CAAC,WAAW,KAAK,gBAAgB,KAAK,CAAW,IAC/D,QAGD,GAAG,EAAY;CACvB;CAEA,OAAO;AACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToHiddenDigits.js","names":[],"sources":["../../../src/formats/formatToHiddenDigits.ts"],"sourcesContent":["const DIGIT = /^\\d$/;\n\ntype DigitCharacterNode = {\n\tkind: \"digit\";\n\tdigit: number;\n\tcharacter: string;\n};\n\ntype OtherCharacterNode = {\n\tkind: \"other\";\n\tcharacter: string;\n};\n\ntype RootCharacterNode = {\n\tkind: \"root\";\n\tdigits: number;\n\tchildren: (DigitCharacterNode | OtherCharacterNode)[];\n};\n\nconst parseToCharacters = (value: string): RootCharacterNode => {\n\tlet digits = 0;\n\n\tconst children = value\n\t\t.split(\"\")\n\t\t.map((character: string): DigitCharacterNode | OtherCharacterNode => {\n\t\t\tif (DIGIT.test(character))\n\t\t\t\treturn { character, kind: \"digit\", digit: ++digits };\n\t\t\treturn { character, kind: \"other\" };\n\t\t});\n\n\treturn { digits, children, kind: \"root\" };\n};\n\nconst normalizeRange = (\n\trange: number | [number, number],\n\tlimit: number,\n): [number, number] => {\n\tif (Array.isArray(range)) return range;\n\tif (range >= 0) return [0, range];\n\treturn [limit + 1 - Math.abs(range), limit];\n};\n\nconst within = (range: [number, number], value: number): boolean =>\n\tvalue >= range[0] && value <= range[1];\n\n/**\n * Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.\n *\n * @param value - The input string to mask.\n * @param options.range - Which digits to hide:\n * - Positive number `n` — hides the first `n` digits.\n * - Negative number `-n` — hides the last `n` digits.\n * - Tuple `[start, end]` — hides digits from position `start` to `end` (inclusive, 1-indexed).\n * - Defaults to `3`.\n * @param options.hider - The masking character. Defaults to `\"*\"`.\n * @returns The string with the specified digit positions replaced.\n *\n * @example\n * ```typescript\n * formatToHiddenDigits(\"123-456-7890\", { range: 3 }); // \"***-456-7890\"\n * formatToHiddenDigits(\"123-456-7890\", { range: [4, 6], hider: \"#\" }); // \"123-###-7890\"\n * ```\n */\n\nfunction formatToHiddenDigits(\n\tvalue: string,\n\toptions?: { range?: number | [number, number]; hider?: string },\n): string {\n\tconst characters = parseToCharacters(value);\n\tconst range = normalizeRange(options?.range ?? 3, characters.digits);\n\n\tconst mappedCharacters = characters.children.map((node) => {\n\t\tif (node.kind === \"digit\" && within(range, node.digit))\n\t\t\treturn options?.hider ?? \"*\";\n\t\treturn node.character;\n\t});\n\n\treturn mappedCharacters.join(\"\");\n}\n\nexport { formatToHiddenDigits };\n"],"mappings":";AAAA,IAAM,IAAQ,QAmBR,KAAqB,MAAqC;CAC/D,IAAI,IAAS,GAEP,IAAW,EACf,MAAM,EAAE,CAAC,CACT,KAAK,MACD,EAAM,KAAK,CAAS,IAChB;EAAE;EAAW,MAAM;EAAS,OAAO,EAAE;CAAO,IAC7C;EAAE;EAAW,MAAM;CAAQ,CAClC;CAEF,OAAO;EAAE;EAAQ;EAAU,MAAM;CAAO;AACzC,GAEM,KACL,GACA,MAEI,MAAM,QAAQ,CAAK,IAAU,IAC7B,KAAS,IAAU,CAAC,GAAG,CAAK,IACzB,CAAC,IAAQ,IAAI,KAAK,IAAI,CAAK,GAAG,CAAK,GAGrC,KAAU,GAAyB,MACxC,KAAS,EAAM,MAAM,KAAS,EAAM;AAqBrC,SAAS,EACR,GACA,GACS;CACT,IAAM,IAAa,EAAkB,CAAK,GACpC,IAAQ,EAAe,GAAS,SAAS,GAAG,EAAW,MAAM;CAQnE,OANyB,EAAW,SAAS,KAAK,MAC7C,EAAK,SAAS,WAAW,EAAO,GAAO,EAAK,KAAK,IAC7C,GAAS,SAAS,MACnB,EAAK,SAGN,CAAA,CAAiB,KAAK,EAAE;AAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToPhone.js","names":[],"sources":["../../../src/formats/formatToPhone.ts"],"sourcesContent":["import { parsePhoneNumberWithError } from \"libphonenumber-js\";\nimport { findCountryMask } from \"../utilities/findCountryMask\";\n\n/**\n * Formats a phone number string according to the country mask defined in `@arkyn/templates`.\n *\n * The function parses the input using libphonenumber-js to determine the country and\n * national number, then applies the corresponding country's mask (underscore `_` used\n * as digit placeholder) replacing placeholders with actual digits.\n *\n * @param phoneNumber - The input phone number in E.164 format (e.g. `\"+5534920524282\"`).\n * @returns The phone number formatted according to the country's mask.\n *\n * @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.\n *\n * @example\n * ```typescript\n * console.log(formatToPhone(\"+5534920524282\")); // Output: \"(34) 92052-4282\" (Brazilian format)\n * console.log(formatToPhone(\"+553420524282\")); // Output: \"(34) 2052-4282\" (Brazilian format with optional ninth digit)\n * console.log(formatToPhone(\"+12125550199\")); // Output: \"(212) 555-0199\" (American Samoa format)\n * ```\n */\n\nfunction formatToPhone(phoneNumber: string): string {\n\ttry {\n\t\tconst parsedPhone = parsePhoneNumberWithError(phoneNumber);\n\t\tconst phoneNumberDigits = parsedPhone.nationalNumber.toString();\n\n\t\tlet formattedNumber = findCountryMask(phoneNumber)[0];\n\n\t\tfor (\n\t\t\tlet i = 0, j = 0;\n\t\t\ti < formattedNumber.length && j < phoneNumberDigits.length;\n\t\t\ti++\n\t\t) {\n\t\t\tif (formattedNumber[i] === \"_\") {\n\t\t\t\tformattedNumber =\n\t\t\t\t\tformattedNumber.substring(0, i) +\n\t\t\t\t\tphoneNumberDigits[j] +\n\t\t\t\t\tformattedNumber.substring(i + 1);\n\t\t\t\tj++;\n\t\t\t}\n\t\t}\n\n\t\treturn formattedNumber;\n\t} catch (rawError) {\n\t\tconst error = rawError as Error;\n\t\tthrow new Error(error.message);\n\t}\n}\n\nexport { formatToPhone };\n"],"mappings":";;;AAuBA,SAAS,EAAc,GAA6B;CACnD,IAAI;EAEH,IAAM,IADc,EAA0B,CACpB,CAAA,CAAY,eAAe,SAAS,GAE1D,IAAkB,EAAgB,CAAW,CAAC,CAAC;EAEnD,KACC,IAAI,IAAI,GAAG,IAAI,GACf,IAAI,EAAgB,UAAU,IAAI,EAAkB,QACpD,KAEA,AAAI,EAAgB,OAAO,QAC1B,IACC,EAAgB,UAAU,GAAG,CAAC,IAC9B,EAAkB,KAClB,EAAgB,UAAU,IAAI,CAAC,GAChC;EAIF,OAAO;CACR,SAAS,GAAU;EAElB,MAAU,MAAM,EAAM,OAAO;CAC9B;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateColorByString.js","names":[],"sources":["../../../src/generators/generateColorByString.ts"],"sourcesContent":["/**\n * Generates a hexadecimal color code based on the input string.\n * The function creates a hash from the string and uses it to calculate\n * RGB values, which are then converted to a hexadecimal color code.\n *\n * @param rawString - The input string used to generate the color.\n * @returns A hexadecimal color code (e.g., `\"#a1b2c3\"`) derived from the input string.\n *\n * @example\n * ```typescript\n * const color = generateColorByString(\"example\");\n * console.log(color); // Outputs a consistent hex color like \"#5e8f9a\"\n * ```\n */\n\nfunction generateColorByString(rawString: string): string {\n\tlet hash = 0;\n\n\tfor (let i = 0; i < rawString.length; i++) {\n\t\thash = rawString.charCodeAt(i) + ((hash << 5) - hash);\n\t}\n\n\tconst red = (hash & 0xff0000) >> 16;\n\tconst green = (hash & 0x00ff00) >> 8;\n\tconst blue = hash & 0x0000ff;\n\n\tconst redHex = red.toString(16).padStart(2, \"0\");\n\tconst greenHex = green.toString(16).padStart(2, \"0\");\n\tconst blueHex = blue.toString(16).padStart(2, \"0\");\n\n\treturn `#${redHex}${greenHex}${blueHex}`;\n}\n\nexport { generateColorByString };\n"],"mappings":";AAeA,SAAS,EAAsB,GAA2B;CACzD,IAAI,IAAO;CAEX,KAAK,IAAI,IAAI,GAAG,IAAI,EAAU,QAAQ,KACrC,IAAO,EAAU,WAAW,CAAC,MAAM,KAAQ,KAAK;CAGjD,IAAM,KAAO,IAAO,aAAa,IAC3B,KAAS,IAAO,UAAa,GAC7B,IAAO,IAAO;CAMpB,OAAO,IAJQ,EAAI,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAIjC,IAHM,EAAM,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAG5B,IAFJ,EAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAEf;AAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateId.js","names":[],"sources":["../../../src/generators/generateId.ts"],"sourcesContent":["function hexToBin(hex: string) {\n\thex = hex.replace(/-/g, \"\");\n\tconst buffer = new Uint8Array(hex.length / 2);\n\n\tfor (let i = 0; i < hex.length; i += 2) {\n\t\tbuffer[i / 2] = parseInt(hex.substring(i, i + 2), 16);\n\t}\n\n\treturn buffer;\n}\n\nfunction uuidV4() {\n\tconst uuid = crypto.randomUUID();\n\treturn { text: uuid, binary: hexToBin(uuid) };\n}\n\nfunction uuidV7() {\n\tconst bytes = crypto.getRandomValues(new Uint8Array(16));\n\n\tconst ts = BigInt(Date.now());\n\n\tbytes[0] = Number((ts >> 40n) & 0xffn);\n\tbytes[1] = Number((ts >> 32n) & 0xffn);\n\tbytes[2] = Number((ts >> 24n) & 0xffn);\n\tbytes[3] = Number((ts >> 16n) & 0xffn);\n\tbytes[4] = Number((ts >> 8n) & 0xffn);\n\tbytes[5] = Number(ts & 0xffn);\n\n\t// versão 7\n\tbytes[6] = (bytes[6] & 0x0f) | 0x70;\n\n\t// variante RFC 4122\n\tbytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n\tconst uuid = [...bytes]\n\t\t.map((b) => b.toString(16).padStart(2, \"0\"))\n\t\t.join(\"\")\n\t\t.replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, \"$1-$2-$3-$4-$5\");\n\n\treturn {\n\t\ttext: uuid,\n\t\tbinary: hexToBin(uuid),\n\t};\n}\n\n/**\n * Generates a UUID in the specified version and output type.\n *\n * @param type - Output representation: `\"text\"` (string) or `\"binary\"` (`Uint8Array`).\n * @param format - UUID version: `\"v4\"` (random) or `\"v7\"` (time-ordered).\n * @returns The UUID as a string or `Uint8Array` depending on `type`.\n *\n * @example\n * ```typescript\n * generateId(\"text\", \"v4\"); // \"550e8400-e29b-41d4-a716-446655440000\"\n * generateId(\"binary\", \"v7\"); // Uint8Array([...])\n * ```\n */\nfunction generateId(type: \"text\", format: \"v4\" | \"v7\"): string;\nfunction generateId(type: \"binary\", format: \"v4\" | \"v7\"): Uint8Array;\nfunction generateId(\n\ttype: \"text\" | \"binary\",\n\tformat: \"v4\" | \"v7\",\n): string | Uint8Array {\n\tif (type === \"text\" && format === \"v4\") return uuidV4().text;\n\tif (type === \"binary\" && format === \"v4\") return uuidV4().binary;\n\tif (type === \"text\" && format === \"v7\") return uuidV7().text;\n\tif (type === \"binary\" && format === \"v7\") return uuidV7().binary;\n\tthrow new Error(\"Invalid type or format\");\n}\n\nexport { generateId };\n"],"mappings":";AAAA,SAAS,EAAS,GAAa;CAC9B,IAAM,EAAI,QAAQ,MAAM,EAAE;CAC1B,IAAM,IAAS,IAAI,WAAW,EAAI,SAAS,CAAC;CAE5C,KAAK,IAAI,IAAI,GAAG,IAAI,EAAI,QAAQ,KAAK,GACpC,EAAO,IAAI,KAAK,SAAS,EAAI,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE;CAGrD,OAAO;AACR;AAEA,SAAS,IAAS;CACjB,IAAM,IAAO,OAAO,WAAW;CAC/B,OAAO;EAAE,MAAM;EAAM,QAAQ,EAAS,CAAI;CAAE;AAC7C;AAEA,SAAS,IAAS;CACjB,IAAM,IAAQ,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,GAEjD,IAAK,OAAO,KAAK,IAAI,CAAC;CAa5B,AAXA,EAAM,KAAK,OAAQ,KAAM,MAAO,IAAK,GACrC,EAAM,KAAK,OAAQ,KAAM,MAAO,IAAK,GACrC,EAAM,KAAK,OAAQ,KAAM,MAAO,IAAK,GACrC,EAAM,KAAK,OAAQ,KAAM,MAAO,IAAK,GACrC,EAAM,KAAK,OAAQ,KAAM,KAAM,IAAK,GACpC,EAAM,KAAK,OAAO,IAAK,IAAK,GAG5B,EAAM,KAAM,EAAM,KAAK,KAAQ,KAG/B,EAAM,KAAM,EAAM,KAAK,KAAQ;CAE/B,IAAM,IAAO,CAAC,GAAG,CAAK,CAAC,CACrB,KAAK,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAC3C,KAAK,EAAE,CAAC,CACR,QAAQ,qCAAqC,gBAAgB;CAE/D,OAAO;EACN,MAAM;EACN,QAAQ,EAAS,CAAI;CACtB;AACD;AAiBA,SAAS,EACR,GACA,GACsB;CACtB,IAAI,MAAS,UAAU,MAAW,MAAM,OAAO,EAAO,CAAC,CAAC;CACxD,IAAI,MAAS,YAAY,MAAW,MAAM,OAAO,EAAO,CAAC,CAAC;CAC1D,IAAI,MAAS,UAAU,MAAW,MAAM,OAAO,EAAO,CAAC,CAAC;CACxD,IAAI,MAAS,YAAY,MAAW,MAAM,OAAO,EAAO,CAAC,CAAC;CAC1D,MAAU,MAAM,wBAAwB;AACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSlug.js","names":[],"sources":["../../../src/generators/generateSlug.ts"],"sourcesContent":["/**\n * Generates a URL-friendly slug from a given string.\n *\n * The function performs the following transformations:\n * - Normalizes the string to remove diacritical marks (e.g., accents).\n * - Removes non-alphanumeric characters except for spaces and hyphens.\n * - Replaces spaces with hyphens.\n * - Converts the string to lowercase.\n * - Collapses multiple consecutive hyphens into a single hyphen.\n * - Trims leading and trailing hyphens.\n *\n * @param rawString - The input string to be converted into a slug.\n * @returns A URL-friendly slug derived from the input string.\n *\n * @example\n * ```typescript\n * const slug = generateSlug(\"Hello, World! This is a Test.\");\n * console.log(slug); // Outputs: \"hello-world-this-is-a-test\"\n * ```\n */\n\nfunction generateSlug(rawString: string): string {\n\tlet slug = rawString.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\");\n\n\tslug = slug\n\t\t.replace(/[^\\w\\s-]/g, \"\")\n\t\t.replace(/\\s+/g, \"-\")\n\t\t.toLowerCase();\n\n\tslug = slug.replace(/-{2,}/g, \"-\");\n\n\tslug = slug.replace(/^-+|-+$/g, \"\");\n\n\treturn slug;\n}\n\nexport { generateSlug };\n"],"mappings":";AAqBA,SAAS,EAAa,GAA2B;CAChD,IAAI,IAAO,EAAU,UAAU,KAAK,CAAC,CAAC,QAAQ,oBAAoB,EAAE;CAWpE,OATA,IAAO,EACL,QAAQ,aAAa,EAAE,CAAC,CACxB,QAAQ,QAAQ,GAAG,CAAC,CACpB,YAAY,GAEd,IAAO,EAAK,QAAQ,UAAU,GAAG,GAEjC,IAAO,EAAK,QAAQ,YAAY,EAAE,GAE3B;AACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseLargeFields.js","names":[],"sources":["../../../src/parsers/parseLargeFields.ts"],"sourcesContent":["/**\n * Truncates large string fields in a JSON string to a specified maximum length.\n *\n * This function parses a JSON string, traverses its structure recursively, and truncates\n * any string fields that exceed the specified maximum length. If a string field is truncated,\n * it is replaced with a message indicating the original length of the field.\n *\n * @param jsonString - The JSON string to process.\n * @param maxLength - The maximum allowed length for string fields. Defaults to 1000.\n * @returns A JSON string with large string fields truncated.\n *\n * @throws {Error} Throws an error if the input is not a valid JSON string.\n *\n * @example\n * ```typescript\n * const json = JSON.stringify({\n * name: \"John\",\n * description: \"A very long description that exceeds the maximum length...\",\n * nested: { details: \"Another long string that needs truncation.\" }\n * });\n *\n * const result = parseLargeFields(json, 50);\n * console.log(result);\n * // Output: '{\"name\":\"John\",\"description\":\"To large information: field as 57 characters\",\"nested\":{\"details\":\"To large information: field as 43 characters\"}}'\n * ```\n */\n\nfunction parseLargeFields(\n\tjsonString: string,\n\tmaxLength: number = 1000,\n): string {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction truncateValue(value: any): any {\n\t\tif (typeof value === \"string\" && value.length > maxLength) {\n\t\t\treturn `To large information: field as ${value.length} characters`;\n\t\t}\n\t\treturn value;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction recursiveTruncate(obj: any): any {\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => recursiveTruncate(item));\n\t\t} else if (obj !== null && typeof obj === \"object\") {\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries(obj).map(([key, value]) => [\n\t\t\t\t\tkey,\n\t\t\t\t\trecursiveTruncate(value),\n\t\t\t\t]),\n\t\t\t);\n\t\t}\n\t\treturn truncateValue(obj);\n\t}\n\n\ttry {\n\t\tconst parsedJson = JSON.parse(jsonString);\n\t\tconst truncatedJson = recursiveTruncate(parsedJson);\n\t\treturn JSON.stringify(truncatedJson);\n\t} catch (_error) {\n\t\tthrow new Error(\"Invalid JSON string\");\n\t}\n}\n\nexport { parseLargeFields };\n"],"mappings":";AA2BA,SAAS,EACR,GACA,IAAoB,KACX;CAET,SAAS,EAAc,GAAiB;EAIvC,OAHI,OAAO,KAAU,YAAY,EAAM,SAAS,IACxC,kCAAkC,EAAM,OAAO,eAEhD;CACR;CAGA,SAAS,EAAkB,GAAe;EAWzC,OAVI,MAAM,QAAQ,CAAG,IACb,EAAI,KAAK,MAAS,EAAkB,CAAI,CAAC,IACtB,OAAO,KAAQ,YAA/B,IACH,OAAO,YACb,OAAO,QAAQ,CAAG,CAAC,CAAC,KAAK,CAAC,GAAK,OAAW,CACzC,GACA,EAAkB,CAAK,CACxB,CAAC,CACF,IAEM,EAAc,CAAG;CACzB;CAEA,IAAI;EAEH,IAAM,IAAgB,EADH,KAAK,MAAM,CACU,CAAU;EAClD,OAAO,KAAK,UAAU,CAAa;CACpC,QAAiB;EAChB,MAAU,MAAM,qBAAqB;CACtC;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseSensitiveData.js","names":[],"sources":["../../../src/parsers/parseSensitiveData.ts"],"sourcesContent":["/**\n * Masks sensitive data in a JSON string by replacing the values of specified keys with \"****\".\n *\n * @param jsonString - The JSON string to be processed.\n * @param sensitiveKeys - Keys whose values will be replaced with `\"****\"`. Defaults to `[\"password\", \"confirmPassword\", \"creditCard\"]`.\n * @returns A JSON string with sensitive values masked. Returns the original string if it is not valid JSON.\n *\n * @example\n * ```typescript\n * const jsonString = JSON.stringify({\n * username: \"user123\",\n * password: \"secret\",\n * profile: { creditCard: \"1234-5678-9012-3456\" },\n * });\n *\n * const result = parseSensitiveData(jsonString, [\"password\", \"creditCard\"]);\n * console.log(result); // Output: '{\"username\":\"user123\",\"password\":\"****\",\"profile\":{\"creditCard\":\"****\"}}'\n * ```\n */\n\nfunction parseSensitiveData(\n\tjsonString: string,\n\tsensitiveKeys: string[] = [\"password\", \"confirmPassword\", \"creditCard\"],\n): string {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction maskValue(key: string, value: any): any {\n\t\tif (sensitiveKeys.includes(key)) return \"****\";\n\t\treturn value;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction recursiveMask(obj: any): any {\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => recursiveMask(item));\n\t\t} else if (obj !== null && typeof obj === \"object\") {\n\t\t\treturn Object.keys(obj).reduce(\n\t\t\t\t(acc, key) => {\n\t\t\t\t\tlet value = obj[key];\n\t\t\t\t\tif (typeof value === \"string\") {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst parsedValue = JSON.parse(value);\n\t\t\t\t\t\t\tif (typeof parsedValue === \"object\") {\n\t\t\t\t\t\t\t\tvalue = JSON.stringify(recursiveMask(parsedValue));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (_e) {}\n\t\t\t\t\t}\n\t\t\t\t\tacc[key] = recursiveMask(maskValue(key, value));\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{} as Record<string, unknown>,\n\t\t\t);\n\t\t}\n\t\treturn obj;\n\t}\n\n\ttry {\n\t\tconst jsonObject = JSON.parse(jsonString);\n\t\tconst maskedObject = recursiveMask(jsonObject);\n\t\treturn JSON.stringify(maskedObject);\n\t} catch (_error) {\n\t\treturn jsonString;\n\t}\n}\n\nexport { parseSensitiveData };\n"],"mappings":";AAoBA,SAAS,EACR,GACA,IAA0B;CAAC;CAAY;CAAmB;AAAY,GAC7D;CAET,SAAS,EAAU,GAAa,GAAiB;EAEhD,OADI,EAAc,SAAS,CAAG,IAAU,SACjC;CACR;CAGA,SAAS,EAAc,GAAe;EAqBrC,OApBI,MAAM,QAAQ,CAAG,IACb,EAAI,KAAK,MAAS,EAAc,CAAI,CAAC,IAClB,OAAO,KAAQ,YAA/B,IACH,OAAO,KAAK,CAAG,CAAC,CAAC,QACtB,GAAK,MAAQ;GACb,IAAI,IAAQ,EAAI;GAChB,IAAI,OAAO,KAAU,UACpB,IAAI;IACH,IAAM,IAAc,KAAK,MAAM,CAAK;IACpC,AAAI,OAAO,KAAgB,aAC1B,IAAQ,KAAK,UAAU,EAAc,CAAW,CAAC;GAEnD,QAAa,CAAC;GAGf,OADA,EAAI,KAAO,EAAc,EAAU,GAAK,CAAK,CAAC,GACvC;EACR,GACA,CAAC,CACF,IAEM;CACR;CAEA,IAAI;EAEH,IAAM,IAAe,EADF,KAAK,MAAM,CACK,CAAU;EAC7C,OAAO,KAAK,UAAU,CAAY;CACnC,QAAiB;EAChB,OAAO;CACR;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseToDate.js","names":[],"sources":["../../../src/parsers/parseToDate.ts"],"sourcesContent":["import { ValidateDateService } from \"../services/validateDateService\";\n\n/**\n * Parses a date (and optional time) string into a JavaScript `Date` object.\n * All calculations are in UTC+0; use `timezone` to shift the result.\n *\n * @param date - Date string in the format determined by `inputFormat`.\n * @param time - Optional time string `\"HH:mm:ss\"` (defaults to `\"00:00:00\"`).\n * @param inputFormat - Parsing format:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"isoDate\"`: MM-DD-YYYY\n * - `\"timestamp\"`: YYYY-MM-DD\n * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.\n * @returns A `Date` object representing the parsed date and time.\n *\n * @example\n * ```typescript\n * parseToDate([\"25/12/2023\", \"15:30:00\"], \"brazilianDate\", -3);\n * // Date: 2023-12-25T12:30:00.000Z\n *\n * parseToDate([\"2023-12-25\"], \"timestamp\");\n * // Date: 2023-12-25T00:00:00.000Z\n * ```\n */\n\nfunction parseToDate(\n\t[date, time = \"00:00:00\"]: string[],\n\tinputFormat: \"brazilianDate\" | \"isoDate\" | \"timestamp\",\n\ttimezone: number = 0,\n): Date {\n\tconst validateDateService = new ValidateDateService();\n\tvalidateDateService.validateInputFormat(inputFormat);\n\n\tconst dateParts = date.split(/[-/]/).map(Number);\n\tconst timeParts = time.split(\".\")[0].split(\":\").map(Number);\n\n\tlet day: number, month: number, year: number;\n\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\n\tswitch (inputFormat) {\n\t\tcase \"brazilianDate\":\n\t\t\t[day, month, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"isoDate\":\n\t\t\t[month, day, year] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t\tcase \"timestamp\":\n\t\t\t[year, month, day] = dateParts;\n\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\tbreak;\n\t}\n\n\tconst formattedDate = new Date(\n\t\tDate.UTC(year, month - 1, day, hours, minutes, seconds),\n\t);\n\n\tif (Number.isNaN(formattedDate.getTime())) throw new Error(\"Invalid date\");\n\n\tformattedDate.setUTCHours(formattedDate.getUTCHours() + timezone);\n\n\treturn formattedDate;\n}\n\nexport { parseToDate };\n"],"mappings":";;AAyBA,SAAS,EACR,CAAC,GAAM,IAAO,aACd,GACA,IAAmB,GACZ;CACP,IAAM,IAAsB,IAAI,EAAoB;CACpD,EAAoB,oBAAoB,CAAW;CAEnD,IAAM,IAAY,EAAK,MAAM,MAAM,CAAC,CAAC,IAAI,MAAM,GACzC,IAAY,EAAK,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM,GAEtD,GAAa,GAAe,GAC1B,CAAC,IAAQ,GAAG,IAAU,GAAG,IAAU,KAAK;CAE9C,QAAQ,GAAR;EACC,KAAK;GAEJ,AADA,CAAC,GAAK,GAAO,KAAQ,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;EACD,KAAK;GAEJ,AADA,CAAC,GAAO,GAAK,KAAQ,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;EACD,KAAK;GAEJ,AADA,CAAC,GAAM,GAAO,KAAO,GACrB,EAAoB,kBAAkB,GAAM,GAAO,CAAG;GACtD;CACF;CAEA,IAAM,IAAgB,IAAI,KACzB,KAAK,IAAI,GAAM,IAAQ,GAAG,GAAK,GAAO,GAAS,CAAO,CACvD;CAEA,IAAI,OAAO,MAAM,EAAc,QAAQ,CAAC,GAAG,MAAU,MAAM,cAAc;CAIzE,OAFA,EAAc,YAAY,EAAc,YAAY,IAAI,CAAQ,GAEzD;AACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateDateService.js","names":[],"sources":["../../../src/services/validateDateService.ts"],"sourcesContent":["/**\n * Validates date components and input format strings for date-parsing utilities.\n * Enforces 4-digit years, month/day ranges, month-specific day counts, and leap year rules.\n *\n * @example\n * ```typescript\n * const service = new ValidateDateService();\n * service.validateDateParts(2024, 2, 29); // OK — leap year\n * service.validateDateParts(2023, 2, 29); // throws — not a leap year\n * service.validateInputFormat(\"brazilianDate\"); // OK\n * service.validateInputFormat(\"custom\"); // throws\n * ```\n */\n\nclass ValidateDateService {\n\tprivate isLeapYear(year: number): boolean {\n\t\treturn (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\t}\n\n\tprivate getDaysInMonth(month: number, year: number): number {\n\t\tconst daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\t\tif (month === 2 && this.isLeapYear(year)) return 29;\n\t\treturn daysInMonth[month - 1];\n\t}\n\n\tprivate validateDayInMonth(day: number, month: number, year: number): void {\n\t\tconst maxDays = this.getDaysInMonth(month, year);\n\n\t\tif (day > maxDays) {\n\t\t\tconst monthNames = [\n\t\t\t\t\"January\",\n\t\t\t\t\"February\",\n\t\t\t\t\"March\",\n\t\t\t\t\"April\",\n\t\t\t\t\"May\",\n\t\t\t\t\"June\",\n\t\t\t\t\"July\",\n\t\t\t\t\"August\",\n\t\t\t\t\"September\",\n\t\t\t\t\"October\",\n\t\t\t\t\"November\",\n\t\t\t\t\"December\",\n\t\t\t];\n\n\t\t\tconst errorMessage = `Day ${day} is not valid for ${monthNames[month - 1]}`;\n\t\t\tconst leapYearMessage = `Day ${day} is not valid for February ${year} (non-leap year)`;\n\n\t\t\tif (month === 2 && day === 29) throw new Error(leapYearMessage);\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\t}\n\n\t/**\n\t * Throws if year, month, or day are out of valid range or inconsistent with the calendar.\n\t *\n\t * @param year - 4-digit year (1000–9999).\n\t * @param month - Month number (1–12).\n\t * @param day - Day number (1–31, validated against the specific month).\n\t */\n\tvalidateDateParts(year: number, month: number, day: number): void {\n\t\tconst messageErrors = {\n\t\t\tyear: \"Year should be four digits\",\n\t\t\tmonth: \"Month should be between 1 and 12\",\n\t\t\tday: \"Day should be between 1 and 31\",\n\t\t};\n\n\t\tif (`${year}`.length !== 4) throw new Error(messageErrors.year);\n\t\tif (month < 1 || month > 12) throw new Error(messageErrors.month);\n\t\tif (day < 1 || day > 31) throw new Error(messageErrors.day);\n\n\t\tthis.validateDayInMonth(day, month, year);\n\t}\n\n\t/**\n\t * Throws if `format` is not one of `\"brazilianDate\"`, `\"isoDate\"`, or `\"timestamp\"`.\n\t *\n\t * @param format - The format string to check.\n\t */\n\tvalidateInputFormat(format: string): void {\n\t\tconst validFormats = [\"brazilianDate\", \"isoDate\", \"timestamp\"];\n\t\tif (!validFormats.includes(format)) {\n\t\t\tthrow new Error(`Invalid input format: ${format}`);\n\t\t}\n\t}\n}\n\nexport { ValidateDateService };\n"],"mappings":";AAcA,IAAM,IAAN,MAA0B;CACzB,WAAmB,GAAuB;EACzC,OAAQ,IAAO,KAAM,KAAK,IAAO,OAAQ,KAAM,IAAO,OAAQ;CAC/D;CAEA,eAAuB,GAAe,GAAsB;EAG3D,OADI,MAAU,KAAK,KAAK,WAAW,CAAI,IAAU,KAC1C;GAFc;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;EAE1D,CAAA,CAAY,IAAQ;CAC5B;CAEA,mBAA2B,GAAa,GAAe,GAAoB;EAG1E,IAAI,IAFY,KAAK,eAAe,GAAO,CAEjC,GAAS;GAgBlB,IAAM,IAAe,OAAO,EAAI,oBAAoB;IAdnD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GAGmD,CAAA,CAAW,IAAQ,MACjE,IAAkB,OAAO,EAAI,6BAA6B,EAAK;GAGrE,MADyC,MAArC,MAAU,KAAK,MAAQ,KAAoB,IAC/B,CAD8C;EAE/D;CACD;CASA,kBAAkB,GAAc,GAAe,GAAmB;EACjE,IAAM,IAAgB;GACrB,MAAM;GACN,OAAO;GACP,KAAK;EACN;EAEA,IAAI,GAAG,IAAO,WAAW,GAAG,MAAU,MAAM,EAAc,IAAI;EAC9D,IAAI,IAAQ,KAAK,IAAQ,IAAI,MAAU,MAAM,EAAc,KAAK;EAChE,IAAI,IAAM,KAAK,IAAM,IAAI,MAAU,MAAM,EAAc,GAAG;EAE1D,KAAK,mBAAmB,GAAK,GAAO,CAAI;CACzC;CAOA,oBAAoB,GAAsB;EAEzC,IAAI,CAAC;GADiB;GAAiB;GAAW;EAC7C,CAAA,CAAa,SAAS,CAAM,GAChC,MAAU,MAAM,yBAAyB,GAAQ;CAEnD;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateCardInstallment.js","names":[],"sources":["../../../src/utilities/calculateCardInstallment.ts"],"sourcesContent":["/**\n * Calculates the per-installment and total price for a card payment plan with compound interest.\n * No interest is applied when `fees` is `0` or `numberInstallments` is `1`.\n *\n * @param props.cashPrice - The base price of the item.\n * @param props.numberInstallments - Number of installments (must be > 0).\n * @param props.fees - Monthly interest rate (defaults to `0.0349`).\n * @returns `{ totalPrice, installmentPrice }` — both rounded to 2 decimal places.\n *\n * @example\n * ```typescript\n * calculateCardInstallment({ cashPrice: 1000, numberInstallments: 12, fees: 0.02 });\n * // { totalPrice: 1124.62, installmentPrice: 93.72 }\n * ```\n */\n\nfunction calculateCardInstallment(props: {\n\tcashPrice: number;\n\tnumberInstallments: number;\n\tfees?: number;\n}): { totalPrice: number; installmentPrice: number } {\n\tconst { cashPrice, numberInstallments, fees = 0.0349 } = props;\n\n\tif (fees === 0 || numberInstallments === 1) {\n\t\treturn {\n\t\t\ttotalPrice: cashPrice,\n\t\t\tinstallmentPrice: cashPrice / numberInstallments,\n\t\t};\n\t}\n\n\tif (numberInstallments <= 0) {\n\t\tthrow new Error(\"Number of installments must be greater than 0\");\n\t}\n\n\tif (fees < 0) {\n\t\tthrow new Error(\"Fees must be greater than or equal to 0\");\n\t}\n\n\tconst numerator = (1 + fees) ** numberInstallments * fees;\n\tconst denominator = (1 + fees) ** numberInstallments - 1;\n\n\tconst installmentPrice = +(cashPrice * (numerator / denominator)).toFixed(2);\n\tconst totalPrice = +(installmentPrice * numberInstallments).toFixed(2);\n\n\treturn {\n\t\ttotalPrice: +totalPrice.toFixed(2),\n\t\tinstallmentPrice: +installmentPrice.toFixed(2),\n\t};\n}\n\nexport { calculateCardInstallment };\n"],"mappings":";AAgBA,SAAS,EAAyB,GAImB;CACpD,IAAM,EAAE,cAAW,uBAAoB,UAAO,UAAW;CAEzD,IAAI,MAAS,KAAK,MAAuB,GACxC,OAAO;EACN,YAAY;EACZ,kBAAkB,IAAY;CAC/B;CAGD,IAAI,KAAsB,GACzB,MAAU,MAAM,+CAA+C;CAGhE,IAAI,IAAO,GACV,MAAU,MAAM,yCAAyC;CAM1D,IAAM,IAAmB,EAAE,MAHR,IAAI,MAAS,IAAqB,MAChC,IAAI,MAAS,IAAqB,IAAA,CAEW,QAAQ,CAAC;CAG3E,OAAO;EACN,YAAY,EAAC,EAHO,IAAmB,EAAA,CAAoB,QAAQ,CAAC,EAAA,CAG5C,QAAQ,CAAC;EACjC,kBAAkB,CAAC,EAAiB,QAAQ,CAAC;CAC9C;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureQuotes.js","names":[],"sources":["../../../src/utilities/ensureQuotes.ts"],"sourcesContent":["/**\n * Ensures that a given rawValue string is enclosed in quotes.\n *\n * This function checks if the input string is already enclosed in either single\n * quotes (`'`) or double quotes (`\"`). If the string is already quoted, it is\n * returned as-is. Otherwise, the function wraps the string in double quotes.\n *\n * @param rawValue - The string to be checked and potentially quoted.\n * @returns The original string if already quoted, otherwise the string wrapped in double quotes.\n *\n * @example\n * ```typescript\n * ensureQuotes('example'); // Returns: '\"example\"'\n * ensureQuotes('\"already quoted\"'); // Returns: '\"already quoted\"'\n * ensureQuotes(\"'single quoted'\"); // Returns: \"'single quoted'\"\n * ```\n */\n\nfunction ensureQuotes(rawValue: string): string {\n\tconst hasSingleQuotes = rawValue.startsWith(\"'\") && rawValue.endsWith(\"'\");\n\tconst hasDoubleQuotes = rawValue.startsWith('\"') && rawValue.endsWith('\"');\n\n\tif (hasSingleQuotes || hasDoubleQuotes) {\n\t\treturn rawValue;\n\t}\n\n\treturn `\"${rawValue}\"`;\n}\n\nexport { ensureQuotes };\n"],"mappings":";AAkBA,SAAS,EAAa,GAA0B;CAC/C,IAAM,IAAkB,EAAS,WAAW,GAAG,KAAK,EAAS,SAAS,GAAG,GACnE,IAAkB,EAAS,WAAW,IAAG,KAAK,EAAS,SAAS,IAAG;CAMzE,OAJI,KAAmB,IACf,IAGD,IAAI,EAAS;AACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCountryMask.js","names":[],"sources":["../../../src/utilities/findCountryMask.ts"],"sourcesContent":["import { type CountryType, countries } from \"@arkyn/templates\";\nimport { parsePhoneNumberWithError } from \"libphonenumber-js\";\nimport { removeNonNumeric } from \"./removeNonNumeric\";\n\n/**\n * Resolves the matching phone mask and country metadata for a given phone number.\n * Masks use `\"_\"` as digit placeholders. For countries with multiple mask lengths\n * (e.g. Brazil with and without the ninth digit), the mask matching the number's\n * digit count is returned.\n *\n * @param phoneNumber - Phone number in E.164 format (e.g. `\"+5511999999999\"`).\n * @returns A tuple of `[maskString, CountryType]`.\n * @throws If the number is invalid or no mask is found for the parsed country.\n *\n * @example\n * ```typescript\n * const [mask, country] = findCountryMask(\"+5511999999999\");\n * // mask: \"(__) _____-____\"\n * // country.name: \"Brazil\"\n * ```\n */\n\nfunction findCountryMask(phoneNumber: string): [string, CountryType] {\n\ttry {\n\t\tconst parsedPhone = parsePhoneNumberWithError(phoneNumber);\n\n\t\tconst countryCode = parsedPhone?.country;\n\t\tif (!countryCode) throw new Error(\"Invalid phone number\");\n\n\t\tconst country = countries.find((c) => c.iso === countryCode);\n\t\tif (!country) throw new Error(\"Phone number country not supported\");\n\n\t\tif (typeof country.mask === \"string\") return [country.mask, country];\n\n\t\tconst maskForLength = country.mask.find((mask) => {\n\t\t\tconst maskDigits = mask.replace(/[^_]/g, \"\");\n\t\t\tconst phoneDigits = removeNonNumeric(parsedPhone.nationalNumber);\n\n\t\t\tconst maskDigitsCount = maskDigits.length;\n\t\t\tconst phoneDigitsCount = phoneDigits.length;\n\n\t\t\treturn maskDigitsCount === phoneDigitsCount;\n\t\t});\n\n\t\tif (!maskForLength) {\n\t\t\tthrow new Error(\"No mask found for the given phone number length\");\n\t\t}\n\n\t\treturn [maskForLength, country];\n\t} catch (rawError) {\n\t\tconst error = rawError as Error;\n\t\tthrow new Error(error.message);\n\t}\n}\n\nexport { findCountryMask };\n"],"mappings":";;;;AAsBA,SAAS,EAAgB,GAA4C;CACpE,IAAI;EACH,IAAM,IAAc,EAA0B,CAAW,GAEnD,IAAc,GAAa;EACjC,IAAI,CAAC,GAAa,MAAU,MAAM,sBAAsB;EAExD,IAAM,IAAU,EAAU,MAAM,MAAM,EAAE,QAAQ,CAAW;EAC3D,IAAI,CAAC,GAAS,MAAU,MAAM,oCAAoC;EAElE,IAAI,OAAO,EAAQ,QAAS,UAAU,OAAO,CAAC,EAAQ,MAAM,CAAO;EAEnE,IAAM,IAAgB,EAAQ,KAAK,MAAM,MAAS;GACjD,IAAM,IAAa,EAAK,QAAQ,SAAS,EAAE,GACrC,IAAc,EAAiB,EAAY,cAAc;GAK/D,OAHwB,EAAW,WACV,EAAY;EAGtC,CAAC;EAED,IAAI,CAAC,GACJ,MAAU,MAAM,iDAAiD;EAGlE,OAAO,CAAC,GAAe,CAAO;CAC/B,SAAS,GAAU;EAElB,MAAU,MAAM,EAAM,OAAO;CAC9B;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isHtml.js","names":[],"sources":["../../../src/utilities/isHtml.ts"],"sourcesContent":["/**\n * Check if a string contains HTML markup.\n *\n * This function uses a regular expression to detect the presence of HTML tags\n * in a string. The check is case-insensitive and detects both opening\n * and closing tags.\n *\n * @param rawString - The string to check.\n * @returns `true` if the string contains HTML markup, `false` otherwise.\n *\n * @example\n * ```typescript\n * isHtml('<p>Hello world</p>'); // true\n * isHtml('<div>Content</div>'); // true\n * isHtml('Plain text'); // false\n * isHtml(''); // false\n * ```\n */\n\nfunction isHtml(rawString: string): boolean {\n\tconst htmlRegex = /<\\/?[a-z][\\s\\S]*>/i;\n\treturn htmlRegex.test(rawString);\n}\n\nexport { isHtml };\n"],"mappings":";AAmBA,SAAS,EAAO,GAA4B;CAE3C,OAAO,qBAAU,KAAK,CAAS;AAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeCurrencySymbols.js","names":[],"sources":["../../../src/utilities/removeCurrencySymbols.ts"],"sourcesContent":["/**\n * Removes currency symbols from a given formatted string.\n *\n * This function takes a string that may contain currency symbols\n * and removes them using a regular expression. The resulting string\n * is also trimmed of any leading or trailing whitespace.\n *\n * @param rawString - The formatted string that may contain currency symbols.\n * @returns The string with all currency symbols removed and trimmed of whitespace.\n *\n * @example\n * ```typescript\n * removeCurrencySymbols(\"R$13,45\"); // \"13,45\"\n * removeCurrencySymbols(\"$123.45\"); // \"123.45\"\n * removeCurrencySymbols(\"€99.99\"); // \"99.99\"\n * removeCurrencySymbols(\"¥1,000\"); // \"1,000\"\n * removeCurrencySymbols(\"123.45\"); // \"123.45\" (no symbols to remove)\n * ```\n */\n\nfunction removeCurrencySymbols(rawString: string): string {\n\treturn rawString.replace(/(?:R\\$|\\p{Sc}|[$€¥£])/gu, \"\").trim();\n}\n\nexport { removeCurrencySymbols };\n"],"mappings":";AAoBA,SAAS,EAAsB,GAA2B;CACzD,OAAO,EAAU,QAAQ,2BAA2B,EAAE,CAAC,CAAC,KAAK;AAC9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeNonNumeric.js","names":[],"sources":["../../../src/utilities/removeNonNumeric.ts"],"sourcesContent":["/**\n * Removes all non-numeric characters from a given string.\n *\n * @param rawString - The input string to strip non-numeric characters from.\n * @returns A new string containing only the numeric characters from the input.\n *\n * @example\n * ```typescript\n * const result = removeNonNumeric(\"abc123def456\");\n * console.log(result); // Output: \"123456\"\n * ```\n */\n\nfunction removeNonNumeric(rawString: string): string {\n\treturn rawString.replace(/[^0-9]/g, \"\");\n}\n\nexport { removeNonNumeric };\n"],"mappings":";AAaA,SAAS,EAAiB,GAA2B;CACpD,OAAO,EAAU,QAAQ,WAAW,EAAE;AACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripHtmlTags.js","names":[],"sources":["../../../src/utilities/stripHtmlTags.ts"],"sourcesContent":["/**\n * Strips HTML tags from a string.\n *\n * This function removes all HTML tags from the provided string by replacing any content\n * that matches the HTML tag pattern with an empty string.\n *\n * @param rawHtml - The HTML string to strip tags from.\n * @returns The plain text with all HTML tags (including `<script>`, `<style>`, and comments) removed.\n *\n * @example\n * ```typescript\n * const strippedHtml = stripHtmlTags(\"<p>Hello <strong>World</strong></p>\");\n * console.log(strippedHtml); // \"Hello World\"\n * ```\n */\n\nfunction stripHtmlTags(rawHtml: string): string {\n\treturn rawHtml\n\t\t.replace(/<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi, \"\")\n\t\t.replace(/<style\\b[^<]*(?:(?!<\\/style>)<[^<]*)*<\\/style>/gi, \"\")\n\t\t.replace(/<!--[\\s\\S]*?-->/g, \"\")\n\t\t.replace(/<\\/?[a-z][a-z0-9]*[^>]*>/gi, \"\");\n}\n\nexport { stripHtmlTags };\n"],"mappings":";AAgBA,SAAS,EAAc,GAAyB;CAC/C,OAAO,EACL,QAAQ,uDAAuD,EAAE,CAAC,CAClE,QAAQ,oDAAoD,EAAE,CAAC,CAC/D,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,8BAA8B,EAAE;AAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkyn/shared",
|
|
3
|
-
"version": "3.0.1-beta.
|
|
3
|
+
"version": "3.0.1-beta.204",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
"typescript",
|
|
20
20
|
"generators"
|
|
21
21
|
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
22
25
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
24
|
-
"bun": ">=1.
|
|
26
|
+
"node": ">=18.0.0",
|
|
27
|
+
"bun": ">=1.0.0"
|
|
25
28
|
},
|
|
26
29
|
"homepage": "https://docs.arkyn.dev/docs/shared/introduction",
|
|
27
30
|
"repository": {
|
|
@@ -37,7 +40,7 @@
|
|
|
37
40
|
"sideEffects": false,
|
|
38
41
|
"scripts": {
|
|
39
42
|
"audit": "bun audit --workspace packages/shared",
|
|
40
|
-
"build": "bunx vite build && bunx tsc --project tsconfig.json --emitDeclarationOnly && bun ./generate-exports.ts",
|
|
43
|
+
"build": "bunx vite build && bunx tsc --project tsconfig.json --emitDeclarationOnly && bun ./generate-exports.ts && rm -f dist/modules/index.js dist/modules/style.css",
|
|
41
44
|
"prebuild": "rm -rf dist",
|
|
42
45
|
"publish:beta": "npm publish --tag beta",
|
|
43
46
|
"publish:latest": "npm publish --tag latest",
|
|
@@ -49,14 +52,22 @@
|
|
|
49
52
|
"test:watch": "bunx vitest --config vitest.config.ts --watch",
|
|
50
53
|
"typecheck": "bunx tsc --project tsconfig.json --noEmit"
|
|
51
54
|
},
|
|
52
|
-
"dependencies": {
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@arkyn/templates": "workspace:*"
|
|
57
|
+
},
|
|
53
58
|
"peerDependencies": {
|
|
54
59
|
"libphonenumber-js": ">=1.13.7"
|
|
55
60
|
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"libphonenumber-js": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
56
66
|
"devDependencies": {
|
|
57
67
|
"@types/bun": "catalog:",
|
|
58
68
|
"@types/node": "catalog:",
|
|
59
69
|
"libphonenumber-js": "catalog:",
|
|
70
|
+
"typescript": "catalog:",
|
|
60
71
|
"vite": "catalog:",
|
|
61
72
|
"vitest": "catalog:"
|
|
62
73
|
},
|
|
@@ -191,5 +202,84 @@
|
|
|
191
202
|
"types": "./dist/services/validateDateService.d.ts",
|
|
192
203
|
"default": "./dist/modules/services/validateDateService.js"
|
|
193
204
|
}
|
|
205
|
+
},
|
|
206
|
+
"typesVersions": {
|
|
207
|
+
"*": {
|
|
208
|
+
"calculateCardInstallment": [
|
|
209
|
+
"./dist/utilities/calculateCardInstallment.d.ts"
|
|
210
|
+
],
|
|
211
|
+
"ensureQuotes": [
|
|
212
|
+
"./dist/utilities/ensureQuotes.d.ts"
|
|
213
|
+
],
|
|
214
|
+
"findCountryMask": [
|
|
215
|
+
"./dist/utilities/findCountryMask.d.ts"
|
|
216
|
+
],
|
|
217
|
+
"formatDate": [
|
|
218
|
+
"./dist/formats/formatDate.d.ts"
|
|
219
|
+
],
|
|
220
|
+
"formatJsonObject": [
|
|
221
|
+
"./dist/formats/formatJsonObject.d.ts"
|
|
222
|
+
],
|
|
223
|
+
"formatJsonString": [
|
|
224
|
+
"./dist/formats/formatJsonString.d.ts"
|
|
225
|
+
],
|
|
226
|
+
"formatToCapitalizeFirstWordLetter": [
|
|
227
|
+
"./dist/formats/formatToCapitalizeFirstWordLetter.d.ts"
|
|
228
|
+
],
|
|
229
|
+
"formatToCep": [
|
|
230
|
+
"./dist/formats/formatToCep.d.ts"
|
|
231
|
+
],
|
|
232
|
+
"formatToCnpj": [
|
|
233
|
+
"./dist/formats/formatToCnpj.d.ts"
|
|
234
|
+
],
|
|
235
|
+
"formatToCpf": [
|
|
236
|
+
"./dist/formats/formatToCpf.d.ts"
|
|
237
|
+
],
|
|
238
|
+
"formatToCurrency": [
|
|
239
|
+
"./dist/formats/formatToCurrency.d.ts"
|
|
240
|
+
],
|
|
241
|
+
"formatToEllipsis": [
|
|
242
|
+
"./dist/formats/formatToEllipsis.d.ts"
|
|
243
|
+
],
|
|
244
|
+
"formatToHiddenDigits": [
|
|
245
|
+
"./dist/formats/formatToHiddenDigits.d.ts"
|
|
246
|
+
],
|
|
247
|
+
"formatToPhone": [
|
|
248
|
+
"./dist/formats/formatToPhone.d.ts"
|
|
249
|
+
],
|
|
250
|
+
"generateColorByString": [
|
|
251
|
+
"./dist/generators/generateColorByString.d.ts"
|
|
252
|
+
],
|
|
253
|
+
"generateId": [
|
|
254
|
+
"./dist/generators/generateId.d.ts"
|
|
255
|
+
],
|
|
256
|
+
"generateSlug": [
|
|
257
|
+
"./dist/generators/generateSlug.d.ts"
|
|
258
|
+
],
|
|
259
|
+
"isHtml": [
|
|
260
|
+
"./dist/utilities/isHtml.d.ts"
|
|
261
|
+
],
|
|
262
|
+
"parseLargeFields": [
|
|
263
|
+
"./dist/parsers/parseLargeFields.d.ts"
|
|
264
|
+
],
|
|
265
|
+
"parseSensitiveData": [
|
|
266
|
+
"./dist/parsers/parseSensitiveData.d.ts"
|
|
267
|
+
],
|
|
268
|
+
"parseToDate": [
|
|
269
|
+
"./dist/parsers/parseToDate.d.ts"
|
|
270
|
+
],
|
|
271
|
+
"removeCurrencySymbols": [
|
|
272
|
+
"./dist/utilities/removeCurrencySymbols.d.ts"
|
|
273
|
+
],
|
|
274
|
+
"removeNonNumeric": [
|
|
275
|
+
"./dist/utilities/removeNonNumeric.d.ts"
|
|
276
|
+
],
|
|
277
|
+
"stripHtmlTags": [
|
|
278
|
+
"./dist/utilities/stripHtmlTags.d.ts"
|
|
279
|
+
],
|
|
280
|
+
"validateDateService": [
|
|
281
|
+
"./dist/services/validateDateService.d.ts"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
194
284
|
}
|
|
195
285
|
}
|
package/dist/modules/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ValidateDateService as e } from "./services/validateDateService.js";
|
|
2
|
-
import { formatDate as t } from "./formats/formatDate.js";
|
|
3
|
-
import { formatJsonObject as n } from "./formats/formatJsonObject.js";
|
|
4
|
-
import { formatJsonString as r } from "./formats/formatJsonString.js";
|
|
5
|
-
import { formatToCapitalizeFirstWordLetter as i } from "./formats/formatToCapitalizeFirstWordLetter.js";
|
|
6
|
-
import { removeNonNumeric as a } from "./utilities/removeNonNumeric.js";
|
|
7
|
-
import { formatToCep as o } from "./formats/formatToCep.js";
|
|
8
|
-
import { formatToCnpj as s } from "./formats/formatToCnpj.js";
|
|
9
|
-
import { formatToCpf as c } from "./formats/formatToCpf.js";
|
|
10
|
-
import { removeCurrencySymbols as l } from "./utilities/removeCurrencySymbols.js";
|
|
11
|
-
import { formatToCurrency as u } from "./formats/formatToCurrency.js";
|
|
12
|
-
import { formatToEllipsis as d } from "./formats/formatToEllipsis.js";
|
|
13
|
-
import { formatToHiddenDigits as f } from "./formats/formatToHiddenDigits.js";
|
|
14
|
-
import { findCountryMask as p } from "./utilities/findCountryMask.js";
|
|
15
|
-
import { formatToPhone as m } from "./formats/formatToPhone.js";
|
|
16
|
-
import { generateColorByString as h } from "./generators/generateColorByString.js";
|
|
17
|
-
import { generateId as g } from "./generators/generateId.js";
|
|
18
|
-
import { generateSlug as _ } from "./generators/generateSlug.js";
|
|
19
|
-
import { parseLargeFields as v } from "./parsers/parseLargeFields.js";
|
|
20
|
-
import { parseSensitiveData as y } from "./parsers/parseSensitiveData.js";
|
|
21
|
-
import { parseToDate as b } from "./parsers/parseToDate.js";
|
|
22
|
-
import { calculateCardInstallment as x } from "./utilities/calculateCardInstallment.js";
|
|
23
|
-
import { ensureQuotes as S } from "./utilities/ensureQuotes.js";
|
|
24
|
-
import { isHtml as C } from "./utilities/isHtml.js";
|
|
25
|
-
import { stripHtmlTags as w } from "./utilities/stripHtmlTags.js";
|
|
26
|
-
export { e as ValidateDateService, x as calculateCardInstallment, S as ensureQuotes, p as findCountryMask, t as formatDate, n as formatJsonObject, r as formatJsonString, i as formatToCapitalizeFirstWordLetter, o as formatToCep, s as formatToCnpj, c as formatToCpf, u as formatToCurrency, d as formatToEllipsis, f as formatToHiddenDigits, m as formatToPhone, h as generateColorByString, g as generateId, _ as generateSlug, C as isHtml, v as parseLargeFields, y as parseSensitiveData, b as parseToDate, l as removeCurrencySymbols, a as removeNonNumeric, w as stripHtmlTags };
|