@arkyn/shared 3.0.10 → 3.0.12
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/README.md +3 -1
- package/dist/formats/formatDate.d.ts +5 -3
- package/dist/formats/formatDate.d.ts.map +1 -1
- package/dist/formats/formatToCurrency.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -34
- package/dist/index.js.map +1 -1
- package/dist/modules/formats/formatDate.js +3 -15
- package/dist/modules/formats/formatDate.js.map +1 -1
- package/dist/modules/formats/formatToCep.js +1 -1
- package/dist/modules/formats/formatToCep.js.map +1 -1
- package/dist/modules/formats/formatToCnpj.js +1 -1
- package/dist/modules/formats/formatToCnpj.js.map +1 -1
- package/dist/modules/formats/formatToCpf.js +1 -1
- package/dist/modules/formats/formatToCpf.js.map +1 -1
- package/dist/modules/formats/formatToCurrency.js +4 -1
- package/dist/modules/formats/formatToCurrency.js.map +1 -1
- package/dist/modules/parsers/parseToDate.js +3 -15
- package/dist/modules/parsers/parseToDate.js.map +1 -1
- package/dist/modules/services/validateDateService.js +21 -0
- package/dist/modules/services/validateDateService.js.map +1 -1
- package/dist/parsers/parseToDate.d.ts +5 -3
- package/dist/parsers/parseToDate.d.ts.map +1 -1
- package/dist/services/validateDateService.d.ts +31 -2
- package/dist/services/validateDateService.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,7 +166,9 @@ formatToCpf("12345678909"); // "123.456.789-09"
|
|
|
166
166
|
|
|
167
167
|
#### formatToCurrency
|
|
168
168
|
|
|
169
|
-
Formats a number into a locale-aware currency string using `Intl.NumberFormat`, based on a currency code from `@arkyn/templates`. Set `config.showPrefix` to `false` to omit the currency symbol. Throws `Error` for unsupported currency codes.
|
|
169
|
+
Formats a number into a locale-aware currency string using `Intl.NumberFormat`, based on a currency code from `@arkyn/templates`. Set `config.showPrefix` to `false` to omit the currency symbol. Throws `Error` (naming the invalid code and listing the supported ones) for unsupported currency codes.
|
|
170
|
+
|
|
171
|
+
Supported codes (22): `USD`, `EUR`, `JPY`, `GBP`, `AUD`, `CAD`, `CHF`, `CNY`, `SEK`, `NZD`, `BRL`, `INR`, `RUB`, `ZAR`, `MXN`, `SGD`, `HKD`, `NOK`, `KRW`, `TRY`, `IDR`, `THB` — see [`countryCurrencies`](../templates/src/countryCurrencies.ts) in `@arkyn/templates` for the authoritative list.
|
|
170
172
|
|
|
171
173
|
```typescript
|
|
172
174
|
import { formatToCurrency } from "@arkyn/shared";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DateInputFormat } from "../services/validateDateService";
|
|
1
2
|
/**
|
|
2
3
|
* Formats a date (and optional time) string into a custom output format.
|
|
3
4
|
* All calculations are in UTC+0; use the `timezone` parameter to shift the result.
|
|
@@ -6,8 +7,9 @@
|
|
|
6
7
|
* @param time - Optional time string `"HH:mm:ss"` (defaults to `"00:00:00"`).
|
|
7
8
|
* @param inputFormat - Parsing format:
|
|
8
9
|
* - `"brazilianDate"`: DD/MM/YYYY
|
|
9
|
-
* - `"
|
|
10
|
-
* - `"
|
|
10
|
+
* - `"usDate"`: MM-DD-YYYY
|
|
11
|
+
* - `"isoDate"`: deprecated misnamed alias for `"usDate"` — not actually ISO 8601, kept for backward compatibility
|
|
12
|
+
* - `"timestamp"`: YYYY-MM-DD (the actual ISO 8601 date format)
|
|
11
13
|
* @param outputFormat - Output template using `YYYY`, `MM`, `DD`, `hh`, `mm`, `ss` placeholders.
|
|
12
14
|
* @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
|
|
13
15
|
* @returns The formatted date string.
|
|
@@ -21,6 +23,6 @@
|
|
|
21
23
|
* // "2023-12-25 12:30"
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
|
-
declare function formatDate([date, time]: string[], inputFormat:
|
|
26
|
+
declare function formatDate([date, time]: string[], inputFormat: DateInputFormat, outputFormat: string, timezone?: number): string;
|
|
25
27
|
export { formatDate };
|
|
26
28
|
//# sourceMappingURL=formatDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,eAAe,EAEpB,MAAM,iCAAiC,CAAC;AAqBzC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,iBAAS,UAAU,CAClB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,MAAU,GAClB,MAAM,CAsBR;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCurrency.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,KAAK,UAAU,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,iBAAS,gBAAgB,CACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,MAAM,
|
|
1
|
+
{"version":3,"file":"formatToCurrency.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,KAAK,UAAU,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,iBAAS,gBAAgB,CACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,MAAM,CAoBR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { generateSlug } from "./generators/generateSlug";
|
|
|
15
15
|
export { parseLargeFields } from "./parsers/parseLargeFields";
|
|
16
16
|
export { parseSensitiveData } from "./parsers/parseSensitiveData";
|
|
17
17
|
export { parseToDate } from "./parsers/parseToDate";
|
|
18
|
-
export { ValidateDateService } from "./services/validateDateService";
|
|
18
|
+
export { type DateInputFormat, ValidateDateService, } from "./services/validateDateService";
|
|
19
19
|
export { calculateCardInstallment } from "./utilities/calculateCardInstallment";
|
|
20
20
|
export { ensureQuotes } from "./utilities/ensureQuotes";
|
|
21
21
|
export { findCountryMask } from "./utilities/findCountryMask";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,aAAa,E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BAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EACN,KAAK,eAAe,EACpB,mBAAmB,GACnB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -55,9 +55,30 @@ var r = class {
|
|
|
55
55
|
if (![
|
|
56
56
|
"brazilianDate",
|
|
57
57
|
"isoDate",
|
|
58
|
+
"usDate",
|
|
58
59
|
"timestamp"
|
|
59
60
|
].includes(e)) throw Error(`Invalid input format: ${e}`);
|
|
60
61
|
}
|
|
62
|
+
parseDateParts(e, t) {
|
|
63
|
+
let n, r, i;
|
|
64
|
+
switch (t) {
|
|
65
|
+
case "brazilianDate":
|
|
66
|
+
[n, r, i] = e;
|
|
67
|
+
break;
|
|
68
|
+
case "isoDate":
|
|
69
|
+
case "usDate":
|
|
70
|
+
[r, n, i] = e;
|
|
71
|
+
break;
|
|
72
|
+
case "timestamp":
|
|
73
|
+
[i, r, n] = e;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return this.validateDateParts(i, r, n), {
|
|
77
|
+
year: i,
|
|
78
|
+
month: r,
|
|
79
|
+
day: n
|
|
80
|
+
};
|
|
81
|
+
}
|
|
61
82
|
};
|
|
62
83
|
//#endregion
|
|
63
84
|
//#region src/formats/formatDate.ts
|
|
@@ -76,21 +97,9 @@ function i(e, t) {
|
|
|
76
97
|
function a([e, t = "00:00:00"], n, a, o = 0) {
|
|
77
98
|
let s = new r();
|
|
78
99
|
s.validateInputFormat(n);
|
|
79
|
-
let c = e.split(/[-/]/).map(Number), l = t.split(".")[0].split(":").map(Number),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
[u, d, f] = c, s.validateDateParts(f, d, u);
|
|
83
|
-
break;
|
|
84
|
-
case "isoDate":
|
|
85
|
-
[d, u, f] = c, s.validateDateParts(f, d, u);
|
|
86
|
-
break;
|
|
87
|
-
case "timestamp":
|
|
88
|
-
[f, d, u] = c, s.validateDateParts(f, d, u);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
let g = new Date(Date.UTC(f, d - 1, u, p, m, h));
|
|
92
|
-
if (Number.isNaN(g.getTime())) throw Error("Invalid date");
|
|
93
|
-
return g.setUTCHours(g.getUTCHours() + o), i(g, a);
|
|
100
|
+
let c = e.split(/[-/]/).map(Number), [l = 0, u = 0, d = 0] = t.split(".")[0].split(":").map(Number), { year: f, month: p, day: m } = s.parseDateParts(c, n), h = new Date(Date.UTC(f, p - 1, m, l, u, d));
|
|
101
|
+
if (Number.isNaN(h.getTime())) throw Error("Invalid date");
|
|
102
|
+
return h.setUTCHours(h.getUTCHours() + o), i(h, a);
|
|
94
103
|
}
|
|
95
104
|
//#endregion
|
|
96
105
|
//#region src/formats/formatJsonObject.ts
|
|
@@ -133,21 +142,21 @@ function l(e) {
|
|
|
133
142
|
//#endregion
|
|
134
143
|
//#region src/formats/formatToCep.ts
|
|
135
144
|
function u(e) {
|
|
136
|
-
let t = l(e).match(/^(\d{5})(\d{3})$/), n = `CEP must
|
|
145
|
+
let t = l(e).match(/^(\d{5})(\d{3})$/), n = `CEP must contain 8 numeric digits: ${e}`;
|
|
137
146
|
if (!t) throw Error(n);
|
|
138
147
|
return `${t[1]}-${t[2]}`;
|
|
139
148
|
}
|
|
140
149
|
//#endregion
|
|
141
150
|
//#region src/formats/formatToCnpj.ts
|
|
142
151
|
function d(e) {
|
|
143
|
-
let t = l(e).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), n = `CNPJ must
|
|
152
|
+
let t = l(e).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), n = `CNPJ must contain 14 numeric digits: ${e}`;
|
|
144
153
|
if (!t) throw Error(n);
|
|
145
154
|
return `${t[1]}.${t[2]}.${t[3]}/${t[4]}-${t[5]}`;
|
|
146
155
|
}
|
|
147
156
|
//#endregion
|
|
148
157
|
//#region src/formats/formatToCpf.ts
|
|
149
158
|
function f(e) {
|
|
150
|
-
let t = l(e).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), n = `CPF must
|
|
159
|
+
let t = l(e).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), n = `CPF must contain 11 numeric digits: ${e}`;
|
|
151
160
|
if (!t) throw Error(n);
|
|
152
161
|
return `${t[1]}.${t[2]}.${t[3]}-${t[4]}`;
|
|
153
162
|
}
|
|
@@ -159,7 +168,10 @@ function p(e) {
|
|
|
159
168
|
//#endregion
|
|
160
169
|
//#region src/formats/formatToCurrency.ts
|
|
161
170
|
function m(e, n, r) {
|
|
162
|
-
if (!t?.[n])
|
|
171
|
+
if (!t?.[n]) {
|
|
172
|
+
let e = Object.keys(t).join(", ");
|
|
173
|
+
throw Error(`Unsupported currency code: ${n}. Supported codes: ${e}.`);
|
|
174
|
+
}
|
|
163
175
|
let i = r?.showPrefix ?? !0, { countryCurrency: a, countryLanguage: o } = t[n], s = new Intl.NumberFormat(o, {
|
|
164
176
|
style: "currency",
|
|
165
177
|
currency: a
|
|
@@ -320,21 +332,9 @@ function A(e, t = [
|
|
|
320
332
|
function j([e, t = "00:00:00"], n, i = 0) {
|
|
321
333
|
let a = new r();
|
|
322
334
|
a.validateInputFormat(n);
|
|
323
|
-
let o = e.split(/[-/]/).map(Number), s = t.split(".")[0].split(":").map(Number),
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
[c, l, u] = o, a.validateDateParts(u, l, c);
|
|
327
|
-
break;
|
|
328
|
-
case "isoDate":
|
|
329
|
-
[l, c, u] = o, a.validateDateParts(u, l, c);
|
|
330
|
-
break;
|
|
331
|
-
case "timestamp":
|
|
332
|
-
[u, l, c] = o, a.validateDateParts(u, l, c);
|
|
333
|
-
break;
|
|
334
|
-
}
|
|
335
|
-
let m = new Date(Date.UTC(u, l - 1, c, d, f, p));
|
|
336
|
-
if (Number.isNaN(m.getTime())) throw Error("Invalid date");
|
|
337
|
-
return m.setUTCHours(m.getUTCHours() + i), m;
|
|
335
|
+
let o = e.split(/[-/]/).map(Number), [s = 0, c = 0, l = 0] = t.split(".")[0].split(":").map(Number), { year: u, month: d, day: f } = a.parseDateParts(o, n), p = new Date(Date.UTC(u, d - 1, f, s, c, l));
|
|
336
|
+
if (Number.isNaN(p.getTime())) throw Error("Invalid date");
|
|
337
|
+
return p.setUTCHours(p.getUTCHours() + i), p;
|
|
338
338
|
}
|
|
339
339
|
//#endregion
|
|
340
340
|
//#region src/utilities/calculateCardInstallment.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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\tconst lowerCasedSensitiveKeys = sensitiveKeys.map((sensitiveKey) =>\n\t\tsensitiveKey.toLowerCase(),\n\t);\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction maskValue(key: string, value: any): any {\n\t\tif (lowerCasedSensitiveKeys.includes(key.toLowerCase())) 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 (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\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\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 for display/formatting purposes.\n *\n * This function removes content that matches common HTML tag patterns (including\n * `<script>`/`<style>` blocks and HTML comments) using regular expressions, and\n * returns the remaining text as-is.\n *\n * IMPORTANT - this is NOT a security sanitizer:\n * - It is a best-effort, regex-based text transform intended for stripping markup\n * from trusted or display-only content (e.g. generating plain-text previews/excerpts).\n * - It does NOT guarantee removal of all constructs that a browser can execute as\n * markup or script (e.g. malformed/broken tags, unusual nesting, or other\n * HTML-parser edge cases can slip through the regexes below).\n * - It does NOT decode or escape HTML entities, so entity-encoded content is passed\n * through unchanged.\n * - Do NOT rely on this function as an XSS defense or as the sole safeguard before\n * rendering untrusted input as HTML (e.g. via `dangerouslySetInnerHTML` or\n * equivalent). If you need to render untrusted HTML safely, use a dedicated,\n * maintained HTML sanitizer library instead. This function is only safe to use\n * for producing plain text from content you already trust, or purely cosmetic\n * display purposes where script execution is not a concern.\n *\n * @param rawHtml - The HTML string to strip tags from.\n * @returns The plain text with matched 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,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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C9BA,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;;;ACUA,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"}
|
|
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\"`, `\"usDate\"`, 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\", \"usDate\", \"timestamp\"];\n\t\tif (!validFormats.includes(format)) {\n\t\t\tthrow new Error(`Invalid input format: ${format}`);\n\t\t}\n\t}\n\n\t/**\n\t * Splits `[year, month, day]` out of already-split numeric date parts\n\t * according to `inputFormat`, and validates them via {@link validateDateParts}.\n\t *\n\t * Centralizes the date-part ordering shared by `parseToDate`, `formatDate`,\n\t * and `validateDate` so it isn't duplicated (and can't drift) across packages.\n\t *\n\t * @param dateParts - The numeric date components in their format-specific order\n\t * (e.g. `date.split(/[-/]/).map(Number)`).\n\t * @param inputFormat - `\"brazilianDate\"` (DD/MM/YYYY), `\"isoDate\"`/`\"usDate\"`\n\t * (MM-DD-YYYY — `\"isoDate\"` is a deprecated alias for `\"usDate\"`, see\n\t * `DateInputFormat`), or `\"timestamp\"` (YYYY-MM-DD, the actual ISO 8601 date format).\n\t * @returns `{ year, month, day }`.\n\t */\n\tparseDateParts(\n\t\tdateParts: number[],\n\t\tinputFormat: DateInputFormat,\n\t): { year: number; month: number; day: number } {\n\t\tlet day: number;\n\t\tlet month: number;\n\t\tlet year: number;\n\n\t\tswitch (inputFormat) {\n\t\t\tcase \"brazilianDate\":\n\t\t\t\t[day, month, year] = dateParts;\n\t\t\t\tbreak;\n\t\t\tcase \"isoDate\":\n\t\t\tcase \"usDate\":\n\t\t\t\t[month, day, year] = dateParts;\n\t\t\t\tbreak;\n\t\t\tcase \"timestamp\":\n\t\t\t\t[year, month, day] = dateParts;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.validateDateParts(year, month, day);\n\n\t\treturn { year, month, day };\n\t}\n}\n\n/**\n * Parsing format accepted by `parseToDate`, `formatDate`, and `validateDate`:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated. Misnamed alias for `\"usDate\"` (MM-DD-YYYY) — despite\n * the name, this is **not** ISO 8601. Kept for backward compatibility; use\n * `\"usDate\"` instead. For real ISO 8601 dates (YYYY-MM-DD), use `\"timestamp\"`.\n * - `\"timestamp\"`: YYYY-MM-DD — the actual ISO 8601 date format.\n */\ntype DateInputFormat = \"brazilianDate\" | \"isoDate\" | \"usDate\" | \"timestamp\";\n\nexport { type DateInputFormat, ValidateDateService };\n","import {\n\ttype DateInputFormat,\n\tValidateDateService,\n} 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 * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated misnamed alias for `\"usDate\"` — not actually ISO 8601, kept for backward compatibility\n * - `\"timestamp\"`: YYYY-MM-DD (the actual ISO 8601 date format)\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: DateInputFormat,\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\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\tconst { year, month, day } = validateDateService.parseDateParts(\n\t\tdateParts,\n\t\tinputFormat,\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 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 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 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\tconst supported = Object.keys(countryCurrencies).join(\", \");\n\t\tthrow new Error(\n\t\t\t`Unsupported currency code: ${currency}. Supported codes: ${supported}.`,\n\t\t);\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\tconst lowerCasedSensitiveKeys = sensitiveKeys.map((sensitiveKey) =>\n\t\tsensitiveKey.toLowerCase(),\n\t);\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tfunction maskValue(key: string, value: any): any {\n\t\tif (lowerCasedSensitiveKeys.includes(key.toLowerCase())) 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 {\n\ttype DateInputFormat,\n\tValidateDateService,\n} 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 * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated misnamed alias for `\"usDate\"` — not actually ISO 8601, kept for backward compatibility\n * - `\"timestamp\"`: YYYY-MM-DD (the actual ISO 8601 date format)\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: DateInputFormat,\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\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\tconst { year, month, day } = validateDateService.parseDateParts(\n\t\tdateParts,\n\t\tinputFormat,\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 (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\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\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 for display/formatting purposes.\n *\n * This function removes content that matches common HTML tag patterns (including\n * `<script>`/`<style>` blocks and HTML comments) using regular expressions, and\n * returns the remaining text as-is.\n *\n * IMPORTANT - this is NOT a security sanitizer:\n * - It is a best-effort, regex-based text transform intended for stripping markup\n * from trusted or display-only content (e.g. generating plain-text previews/excerpts).\n * - It does NOT guarantee removal of all constructs that a browser can execute as\n * markup or script (e.g. malformed/broken tags, unusual nesting, or other\n * HTML-parser edge cases can slip through the regexes below).\n * - It does NOT decode or escape HTML entities, so entity-encoded content is passed\n * through unchanged.\n * - Do NOT rely on this function as an XSS defense or as the sole safeguard before\n * rendering untrusted input as HTML (e.g. via `dangerouslySetInnerHTML` or\n * equivalent). If you need to render untrusted HTML safely, use a dedicated,\n * maintained HTML sanitizer library instead. This function is only safe to use\n * for producing plain text from content you already trust, or purely cosmetic\n * display purposes where script execution is not a concern.\n *\n * @param rawHtml - The HTML string to strip tags from.\n * @returns The plain text with matched 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>/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Ac;CAIzE,OAFA,EAAc,YAAY,EAAc,YAAY,IAAI,CAAQ,GAEzD;AACR;;;ACvCA,SAAS,EAAyB,GAImB;CACpD,IAAM,EAAE,cAAW,uBAAoB,UAAO,UAAW;CAEzD,IAAI,KAAsB,GACzB,MAAU,MAAM,+CAA+C;CAGhE,IAAI,IAAO,GACV,MAAU,MAAM,yCAAyC;CAG1D,IAAI,MAAS,KAAK,MAAuB,GACxC,OAAO;EACN,YAAY;EACZ,kBAAkB,IAAY;CAC/B;CAMD,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;;;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;;;ACUA,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"}
|
|
@@ -15,21 +15,9 @@ function t(e, t) {
|
|
|
15
15
|
function n([n, r = "00:00:00"], i, a, o = 0) {
|
|
16
16
|
let s = new e();
|
|
17
17
|
s.validateInputFormat(i);
|
|
18
|
-
let c = n.split(/[-/]/).map(Number), l = r.split(".")[0].split(":").map(Number),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[u, d, f] = c, s.validateDateParts(f, d, u);
|
|
22
|
-
break;
|
|
23
|
-
case "isoDate":
|
|
24
|
-
[d, u, f] = c, s.validateDateParts(f, d, u);
|
|
25
|
-
break;
|
|
26
|
-
case "timestamp":
|
|
27
|
-
[f, d, u] = c, s.validateDateParts(f, d, u);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
let g = new Date(Date.UTC(f, d - 1, u, p, m, h));
|
|
31
|
-
if (Number.isNaN(g.getTime())) throw Error("Invalid date");
|
|
32
|
-
return g.setUTCHours(g.getUTCHours() + o), t(g, a);
|
|
18
|
+
let c = n.split(/[-/]/).map(Number), [l = 0, u = 0, d = 0] = r.split(".")[0].split(":").map(Number), { year: f, month: p, day: m } = s.parseDateParts(c, i), h = new Date(Date.UTC(f, p - 1, m, l, u, d));
|
|
19
|
+
if (Number.isNaN(h.getTime())) throw Error("Invalid date");
|
|
20
|
+
return h.setUTCHours(h.getUTCHours() + o), t(h, a);
|
|
33
21
|
}
|
|
34
22
|
//#endregion
|
|
35
23
|
export { n as formatDate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.js","names":[],"sources":["../../../src/formats/formatDate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"formatDate.js","names":[],"sources":["../../../src/formats/formatDate.ts"],"sourcesContent":["import {\n\ttype DateInputFormat,\n\tValidateDateService,\n} 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 * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated misnamed alias for `\"usDate\"` — not actually ISO 8601, kept for backward compatibility\n * - `\"timestamp\"`: YYYY-MM-DD (the actual ISO 8601 date format)\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: DateInputFormat,\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\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\tconst { year, month, day } = validateDateService.parseDateParts(\n\t\tdateParts,\n\t\tinputFormat,\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":";;AAKA,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;AA2BA,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,GAGzC,CAAC,IAAQ,GAAG,IAAU,GAAG,IAAU,KAFvB,EAAK,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAEN,GACxC,EAAE,SAAM,UAAO,WAAQ,EAAoB,eAChD,GACA,CACD,GAEM,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
|
|
2
2
|
//#region src/formats/formatToCep.ts
|
|
3
3
|
function t(t) {
|
|
4
|
-
let n = e(t).match(/^(\d{5})(\d{3})$/), r = `CEP must
|
|
4
|
+
let n = e(t).match(/^(\d{5})(\d{3})$/), r = `CEP must contain 8 numeric digits: ${t}`;
|
|
5
5
|
if (!n) throw Error(r);
|
|
6
6
|
return `${n[1]}-${n[2]}`;
|
|
7
7
|
}
|
|
@@ -1 +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
|
|
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 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,sCAAsC;CAC3D,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM;AAC7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
|
|
2
2
|
//#region src/formats/formatToCnpj.ts
|
|
3
3
|
function t(t) {
|
|
4
|
-
let n = e(t).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), r = `CNPJ must
|
|
4
|
+
let n = e(t).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), r = `CNPJ must contain 14 numeric digits: ${t}`;
|
|
5
5
|
if (!n) throw Error(r);
|
|
6
6
|
return `${n[1]}.${n[2]}.${n[3]}/${n[4]}-${n[5]}`;
|
|
7
7
|
}
|
|
@@ -1 +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
|
|
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 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,wCAAwC;CAC7D,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM;AACjE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
|
|
2
2
|
//#region src/formats/formatToCpf.ts
|
|
3
3
|
function t(t) {
|
|
4
|
-
let n = e(t).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), r = `CPF must
|
|
4
|
+
let n = e(t).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), r = `CPF must contain 11 numeric digits: ${t}`;
|
|
5
5
|
if (!n) throw Error(r);
|
|
6
6
|
return `${n[1]}.${n[2]}.${n[3]}-${n[4]}`;
|
|
7
7
|
}
|
|
@@ -1 +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
|
|
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 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,uCAAuC;CAC5D,IAAI,CAAC,GAAO,MAAU,MAAM,CAAY;CAExC,OAAO,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM,GAAG,GAAG,EAAM;AACrD"}
|
|
@@ -2,7 +2,10 @@ import { removeCurrencySymbols as e } from "../utilities/removeCurrencySymbols.j
|
|
|
2
2
|
import { countryCurrencies as t } from "@arkyn/templates";
|
|
3
3
|
//#region src/formats/formatToCurrency.ts
|
|
4
4
|
function n(n, r, i) {
|
|
5
|
-
if (!t?.[r])
|
|
5
|
+
if (!t?.[r]) {
|
|
6
|
+
let e = Object.keys(t).join(", ");
|
|
7
|
+
throw Error(`Unsupported currency code: ${r}. Supported codes: ${e}.`);
|
|
8
|
+
}
|
|
6
9
|
let a = i?.showPrefix ?? !0, { countryCurrency: o, countryLanguage: s } = t[r], c = new Intl.NumberFormat(s, {
|
|
7
10
|
style: "currency",
|
|
8
11
|
currency: o
|
|
@@ -1 +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(\
|
|
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\tconst supported = Object.keys(countryCurrencies).join(\", \");\n\t\tthrow new Error(\n\t\t\t`Unsupported currency code: ${currency}. Supported codes: ${supported}.`,\n\t\t);\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,IAAW;EACnC,IAAM,IAAY,OAAO,KAAK,CAAiB,CAAC,CAAC,KAAK,IAAI;EAC1D,MAAU,MACT,8BAA8B,EAAS,qBAAqB,EAAU,EACvE;CACD;CAEA,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"}
|
|
@@ -3,21 +3,9 @@ import { ValidateDateService as e } from "../services/validateDateService.js";
|
|
|
3
3
|
function t([t, n = "00:00:00"], r, i = 0) {
|
|
4
4
|
let a = new e();
|
|
5
5
|
a.validateInputFormat(r);
|
|
6
|
-
let o = t.split(/[-/]/).map(Number), s = n.split(".")[0].split(":").map(Number),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[c, l, u] = o, a.validateDateParts(u, l, c);
|
|
10
|
-
break;
|
|
11
|
-
case "isoDate":
|
|
12
|
-
[l, c, u] = o, a.validateDateParts(u, l, c);
|
|
13
|
-
break;
|
|
14
|
-
case "timestamp":
|
|
15
|
-
[u, l, c] = o, a.validateDateParts(u, l, c);
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
let m = new Date(Date.UTC(u, l - 1, c, d, f, p));
|
|
19
|
-
if (Number.isNaN(m.getTime())) throw Error("Invalid date");
|
|
20
|
-
return m.setUTCHours(m.getUTCHours() + i), m;
|
|
6
|
+
let o = t.split(/[-/]/).map(Number), [s = 0, c = 0, l = 0] = n.split(".")[0].split(":").map(Number), { year: u, month: d, day: f } = a.parseDateParts(o, r), p = new Date(Date.UTC(u, d - 1, f, s, c, l));
|
|
7
|
+
if (Number.isNaN(p.getTime())) throw Error("Invalid date");
|
|
8
|
+
return p.setUTCHours(p.getUTCHours() + i), p;
|
|
21
9
|
}
|
|
22
10
|
//#endregion
|
|
23
11
|
export { t as parseToDate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseToDate.js","names":[],"sources":["../../../src/parsers/parseToDate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"parseToDate.js","names":[],"sources":["../../../src/parsers/parseToDate.ts"],"sourcesContent":["import {\n\ttype DateInputFormat,\n\tValidateDateService,\n} 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 * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated misnamed alias for `\"usDate\"` — not actually ISO 8601, kept for backward compatibility\n * - `\"timestamp\"`: YYYY-MM-DD (the actual ISO 8601 date format)\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: DateInputFormat,\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\tconst [hours = 0, minutes = 0, seconds = 0] = timeParts;\n\tconst { year, month, day } = validateDateService.parseDateParts(\n\t\tdateParts,\n\t\tinputFormat,\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":";;AA6BA,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,GAGzC,CAAC,IAAQ,GAAG,IAAU,GAAG,IAAU,KAFvB,EAAK,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,MAEN,GACxC,EAAE,SAAM,UAAO,WAAQ,EAAoB,eAChD,GACA,CACD,GAEM,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"}
|
|
@@ -53,9 +53,30 @@ var e = class {
|
|
|
53
53
|
if (![
|
|
54
54
|
"brazilianDate",
|
|
55
55
|
"isoDate",
|
|
56
|
+
"usDate",
|
|
56
57
|
"timestamp"
|
|
57
58
|
].includes(e)) throw Error(`Invalid input format: ${e}`);
|
|
58
59
|
}
|
|
60
|
+
parseDateParts(e, t) {
|
|
61
|
+
let n, r, i;
|
|
62
|
+
switch (t) {
|
|
63
|
+
case "brazilianDate":
|
|
64
|
+
[n, r, i] = e;
|
|
65
|
+
break;
|
|
66
|
+
case "isoDate":
|
|
67
|
+
case "usDate":
|
|
68
|
+
[r, n, i] = e;
|
|
69
|
+
break;
|
|
70
|
+
case "timestamp":
|
|
71
|
+
[i, r, n] = e;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
return this.validateDateParts(i, r, n), {
|
|
75
|
+
year: i,
|
|
76
|
+
month: r,
|
|
77
|
+
day: n
|
|
78
|
+
};
|
|
79
|
+
}
|
|
59
80
|
};
|
|
60
81
|
//#endregion
|
|
61
82
|
export { e as ValidateDateService };
|
|
@@ -1 +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;
|
|
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\"`, `\"usDate\"`, 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\", \"usDate\", \"timestamp\"];\n\t\tif (!validFormats.includes(format)) {\n\t\t\tthrow new Error(`Invalid input format: ${format}`);\n\t\t}\n\t}\n\n\t/**\n\t * Splits `[year, month, day]` out of already-split numeric date parts\n\t * according to `inputFormat`, and validates them via {@link validateDateParts}.\n\t *\n\t * Centralizes the date-part ordering shared by `parseToDate`, `formatDate`,\n\t * and `validateDate` so it isn't duplicated (and can't drift) across packages.\n\t *\n\t * @param dateParts - The numeric date components in their format-specific order\n\t * (e.g. `date.split(/[-/]/).map(Number)`).\n\t * @param inputFormat - `\"brazilianDate\"` (DD/MM/YYYY), `\"isoDate\"`/`\"usDate\"`\n\t * (MM-DD-YYYY — `\"isoDate\"` is a deprecated alias for `\"usDate\"`, see\n\t * `DateInputFormat`), or `\"timestamp\"` (YYYY-MM-DD, the actual ISO 8601 date format).\n\t * @returns `{ year, month, day }`.\n\t */\n\tparseDateParts(\n\t\tdateParts: number[],\n\t\tinputFormat: DateInputFormat,\n\t): { year: number; month: number; day: number } {\n\t\tlet day: number;\n\t\tlet month: number;\n\t\tlet year: number;\n\n\t\tswitch (inputFormat) {\n\t\t\tcase \"brazilianDate\":\n\t\t\t\t[day, month, year] = dateParts;\n\t\t\t\tbreak;\n\t\t\tcase \"isoDate\":\n\t\t\tcase \"usDate\":\n\t\t\t\t[month, day, year] = dateParts;\n\t\t\t\tbreak;\n\t\t\tcase \"timestamp\":\n\t\t\t\t[year, month, day] = dateParts;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.validateDateParts(year, month, day);\n\n\t\treturn { year, month, day };\n\t}\n}\n\n/**\n * Parsing format accepted by `parseToDate`, `formatDate`, and `validateDate`:\n * - `\"brazilianDate\"`: DD/MM/YYYY\n * - `\"usDate\"`: MM-DD-YYYY\n * - `\"isoDate\"`: deprecated. Misnamed alias for `\"usDate\"` (MM-DD-YYYY) — despite\n * the name, this is **not** ISO 8601. Kept for backward compatibility; use\n * `\"usDate\"` instead. For real ISO 8601 dates (YYYY-MM-DD), use `\"timestamp\"`.\n * - `\"timestamp\"`: YYYY-MM-DD — the actual ISO 8601 date format.\n */\ntype DateInputFormat = \"brazilianDate\" | \"isoDate\" | \"usDate\" | \"timestamp\";\n\nexport { type DateInputFormat, 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;GAAU;EACvD,CAAA,CAAa,SAAS,CAAM,GAChC,MAAU,MAAM,yBAAyB,GAAQ;CAEnD;CAgBA,eACC,GACA,GAC+C;EAC/C,IAAI,GACA,GACA;EAEJ,QAAQ,GAAR;GACC,KAAK;IACJ,CAAC,GAAK,GAAO,KAAQ;IACrB;GACD,KAAK;GACL,KAAK;IACJ,CAAC,GAAO,GAAK,KAAQ;IACrB;GACD,KAAK;IACJ,CAAC,GAAM,GAAO,KAAO;IACrB;EACF;EAIA,OAFA,KAAK,kBAAkB,GAAM,GAAO,CAAG,GAEhC;GAAE;GAAM;GAAO;EAAI;CAC3B;AACD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DateInputFormat } from "../services/validateDateService";
|
|
1
2
|
/**
|
|
2
3
|
* Parses a date (and optional time) string into a JavaScript `Date` object.
|
|
3
4
|
* All calculations are in UTC+0; use `timezone` to shift the result.
|
|
@@ -6,8 +7,9 @@
|
|
|
6
7
|
* @param time - Optional time string `"HH:mm:ss"` (defaults to `"00:00:00"`).
|
|
7
8
|
* @param inputFormat - Parsing format:
|
|
8
9
|
* - `"brazilianDate"`: DD/MM/YYYY
|
|
9
|
-
* - `"
|
|
10
|
-
* - `"
|
|
10
|
+
* - `"usDate"`: MM-DD-YYYY
|
|
11
|
+
* - `"isoDate"`: deprecated misnamed alias for `"usDate"` — not actually ISO 8601, kept for backward compatibility
|
|
12
|
+
* - `"timestamp"`: YYYY-MM-DD (the actual ISO 8601 date format)
|
|
11
13
|
* @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
|
|
12
14
|
* @returns A `Date` object representing the parsed date and time.
|
|
13
15
|
*
|
|
@@ -20,6 +22,6 @@
|
|
|
20
22
|
* // Date: 2023-12-25T00:00:00.000Z
|
|
21
23
|
* ```
|
|
22
24
|
*/
|
|
23
|
-
declare function parseToDate([date, time]: string[], inputFormat:
|
|
25
|
+
declare function parseToDate([date, time]: string[], inputFormat: DateInputFormat, timezone?: number): Date;
|
|
24
26
|
export { parseToDate };
|
|
25
27
|
//# sourceMappingURL=parseToDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseToDate.d.ts","sourceRoot":"","sources":["../../src/parsers/parseToDate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseToDate.d.ts","sourceRoot":"","sources":["../../src/parsers/parseToDate.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,eAAe,EAEpB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,WAAW,CACnB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,EAC5B,QAAQ,GAAE,MAAU,GAClB,IAAI,CAsBN;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -24,11 +24,40 @@ declare class ValidateDateService {
|
|
|
24
24
|
*/
|
|
25
25
|
validateDateParts(year: number, month: number, day: number): void;
|
|
26
26
|
/**
|
|
27
|
-
* Throws if `format` is not one of `"brazilianDate"`, `"isoDate"`, or `"timestamp"`.
|
|
27
|
+
* Throws if `format` is not one of `"brazilianDate"`, `"isoDate"`, `"usDate"`, or `"timestamp"`.
|
|
28
28
|
*
|
|
29
29
|
* @param format - The format string to check.
|
|
30
30
|
*/
|
|
31
31
|
validateInputFormat(format: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Splits `[year, month, day]` out of already-split numeric date parts
|
|
34
|
+
* according to `inputFormat`, and validates them via {@link validateDateParts}.
|
|
35
|
+
*
|
|
36
|
+
* Centralizes the date-part ordering shared by `parseToDate`, `formatDate`,
|
|
37
|
+
* and `validateDate` so it isn't duplicated (and can't drift) across packages.
|
|
38
|
+
*
|
|
39
|
+
* @param dateParts - The numeric date components in their format-specific order
|
|
40
|
+
* (e.g. `date.split(/[-/]/).map(Number)`).
|
|
41
|
+
* @param inputFormat - `"brazilianDate"` (DD/MM/YYYY), `"isoDate"`/`"usDate"`
|
|
42
|
+
* (MM-DD-YYYY — `"isoDate"` is a deprecated alias for `"usDate"`, see
|
|
43
|
+
* `DateInputFormat`), or `"timestamp"` (YYYY-MM-DD, the actual ISO 8601 date format).
|
|
44
|
+
* @returns `{ year, month, day }`.
|
|
45
|
+
*/
|
|
46
|
+
parseDateParts(dateParts: number[], inputFormat: DateInputFormat): {
|
|
47
|
+
year: number;
|
|
48
|
+
month: number;
|
|
49
|
+
day: number;
|
|
50
|
+
};
|
|
32
51
|
}
|
|
33
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Parsing format accepted by `parseToDate`, `formatDate`, and `validateDate`:
|
|
54
|
+
* - `"brazilianDate"`: DD/MM/YYYY
|
|
55
|
+
* - `"usDate"`: MM-DD-YYYY
|
|
56
|
+
* - `"isoDate"`: deprecated. Misnamed alias for `"usDate"` (MM-DD-YYYY) — despite
|
|
57
|
+
* the name, this is **not** ISO 8601. Kept for backward compatibility; use
|
|
58
|
+
* `"usDate"` instead. For real ISO 8601 dates (YYYY-MM-DD), use `"timestamp"`.
|
|
59
|
+
* - `"timestamp"`: YYYY-MM-DD — the actual ISO 8601 date format.
|
|
60
|
+
*/
|
|
61
|
+
type DateInputFormat = "brazilianDate" | "isoDate" | "usDate" | "timestamp";
|
|
62
|
+
export { type DateInputFormat, ValidateDateService };
|
|
34
63
|
//# sourceMappingURL=validateDateService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateDateService.d.ts","sourceRoot":"","sources":["../../src/services/validateDateService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAM,mBAAmB;IACxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,kBAAkB;IA2B1B;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAcjE;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"validateDateService.d.ts","sourceRoot":"","sources":["../../src/services/validateDateService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAM,mBAAmB;IACxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,kBAAkB;IA2B1B;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAcjE;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOzC;;;;;;;;;;;;;OAaG;IACH,cAAc,CACb,SAAS,EAAE,MAAM,EAAE,EACnB,WAAW,EAAE,eAAe,GAC1B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;CAsB/C;AAED;;;;;;;;GAQG;AACH,KAAK,eAAe,GAAG,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE5E,OAAO,EAAE,KAAK,eAAe,EAAE,mBAAmB,EAAE,CAAC"}
|