@arkyn/shared 3.0.1-beta.159 → 3.0.1-beta.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/generators/generateId.d.ts.map +1 -1
  2. package/dist/index.js +343 -344
  3. package/dist/modules/formats/formatDate.js +33 -40
  4. package/dist/modules/formats/formatJsonObject.js +22 -31
  5. package/dist/modules/formats/formatJsonString.js +10 -12
  6. package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js +5 -8
  7. package/dist/modules/formats/formatToCep.js +8 -8
  8. package/dist/modules/formats/formatToCnpj.js +8 -8
  9. package/dist/modules/formats/formatToCpf.js +8 -8
  10. package/dist/modules/formats/formatToCurrency.js +12 -14
  11. package/dist/modules/formats/formatToEllipsis.js +9 -10
  12. package/dist/modules/formats/formatToHiddenDigits.js +21 -11
  13. package/dist/modules/formats/formatToPhone.js +13 -16
  14. package/dist/modules/generators/generateColorByString.js +7 -8
  15. package/dist/modules/generators/generateId.js +28 -22
  16. package/dist/modules/generators/generateSlug.js +6 -6
  17. package/dist/modules/index.js +26 -52
  18. package/dist/modules/parsers/parseLargeFields.js +16 -21
  19. package/dist/modules/parsers/parseSensitiveData.js +27 -25
  20. package/dist/modules/parsers/parseToDate.js +22 -26
  21. package/dist/modules/services/validateDateService.js +60 -58
  22. package/dist/modules/utilities/calculateCardInstallment.js +16 -20
  23. package/dist/modules/utilities/ensureQuotes.js +6 -6
  24. package/dist/modules/utilities/findCountryMask.js +22 -24
  25. package/dist/modules/utilities/isHtml.js +5 -5
  26. package/dist/modules/utilities/removeCurrencySymbols.js +5 -5
  27. package/dist/modules/utilities/removeNonNumeric.js +5 -5
  28. package/dist/modules/utilities/stripHtmlTags.js +5 -5
  29. package/package.json +16 -12
@@ -1,42 +1,35 @@
1
- import { ValidateDateService as p } from "../services/validateDateService.js";
2
- function T(t, c) {
3
- const e = (i) => i.toString().padStart(2, "0"), m = {
4
- YYYY: t.getUTCFullYear().toString(),
5
- YY: t.getUTCFullYear().toString().slice(-2),
6
- MM: e(t.getUTCMonth() + 1),
7
- DD: e(t.getUTCDate()),
8
- hh: e(t.getUTCHours()),
9
- mm: e(t.getUTCMinutes()),
10
- ss: e(t.getUTCSeconds())
11
- };
12
- return c.replace(
13
- /YYYY|YY|MM|DD|hh|mm|ss/g,
14
- (i) => m[i]
15
- );
1
+ import { ValidateDateService as e } from "../services/validateDateService.js";
2
+ //#region src/formats/formatDate.ts
3
+ function t(e, t) {
4
+ let n = (e) => e.toString().padStart(2, "0"), r = {
5
+ YYYY: e.getUTCFullYear().toString(),
6
+ YY: e.getUTCFullYear().toString().slice(-2),
7
+ MM: n(e.getUTCMonth() + 1),
8
+ DD: n(e.getUTCDate()),
9
+ hh: n(e.getUTCHours()),
10
+ mm: n(e.getUTCMinutes()),
11
+ ss: n(e.getUTCSeconds())
12
+ };
13
+ return t.replace(/YYYY|YY|MM|DD|hh|mm|ss/g, (e) => r[e]);
16
14
  }
17
- function U([t, c = "00:00:00"], e, m, i = 0) {
18
- const n = new p();
19
- n.validateInputFormat(e);
20
- const l = t.split(/[-/]/).map(Number), D = c.split(".")[0].split(":").map(Number);
21
- let a, r, s;
22
- const [g = 0, u = 0, Y = 0] = D;
23
- switch (e) {
24
- case "brazilianDate":
25
- [a, r, s] = l, n.validateDateParts(s, r, a);
26
- break;
27
- case "isoDate":
28
- [r, a, s] = l, n.validateDateParts(s, r, a);
29
- break;
30
- case "timestamp":
31
- [s, r, a] = l, n.validateDateParts(s, r, a);
32
- break;
33
- }
34
- const o = new Date(
35
- Date.UTC(s, r - 1, a, g, u, Y)
36
- );
37
- if (isNaN(o.getTime())) throw new Error("Invalid date");
38
- return o.setUTCHours(o.getUTCHours() + i), T(o, m);
15
+ function n([n, r = "00:00:00"], i, a, o = 0) {
16
+ let s = new e();
17
+ s.validateInputFormat(i);
18
+ let c = n.split(/[-/]/).map(Number), l = r.split(".")[0].split(":").map(Number), u, d, f, [p = 0, m = 0, h = 0] = l;
19
+ switch (i) {
20
+ case "brazilianDate":
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 (isNaN(g.getTime())) throw Error("Invalid date");
32
+ return g.setUTCHours(g.getUTCHours() + o), t(g, a);
39
33
  }
40
- export {
41
- U as formatDate
42
- };
34
+ //#endregion
35
+ export { n as formatDate };
@@ -1,32 +1,23 @@
1
- const l = (e, f) => {
2
- const c = " ".repeat(f);
3
- let t = "";
4
- if (typeof e == "object" && e !== null)
5
- if (Array.isArray(e))
6
- e.length === 0 ? t += "[]" : (t += `[
7
- `, e.forEach((r, a) => {
8
- t += c + " " + l(r, f + 1), a < e.length - 1 && (t += ","), t += `
9
- `;
10
- }), t += c + "]");
11
- else {
12
- const r = Object.keys(e);
13
- r.length === 0 ? t += "{}" : (t += `{
14
- `, r.forEach((a, i) => {
15
- t += c + ' "' + a + '": ' + l(e[a], f + 1), i < r.length - 1 && (t += ","), t += `
16
- `;
17
- }), t += c + "}");
18
- }
19
- else if (typeof e == "string")
20
- try {
21
- const r = JSON.parse(e);
22
- t += l(r, f);
23
- } catch {
24
- t += '"' + e + '"';
25
- }
26
- else
27
- t += e;
28
- return t;
29
- };
30
- export {
31
- l as formatJsonObject
1
+ //#region src/formats/formatJsonObject.ts
2
+ var e = (t, n) => {
3
+ let r = " ".repeat(n), i = "";
4
+ if (typeof t == "object" && t) if (Array.isArray(t)) t.length === 0 ? i += "[]" : (i += "[\n", t.forEach((a, o) => {
5
+ i += r + " " + e(a, n + 1), o < t.length - 1 && (i += ","), i += "\n";
6
+ }), i += r + "]");
7
+ else {
8
+ let a = Object.keys(t);
9
+ a.length === 0 ? i += "{}" : (i += "{\n", a.forEach((o, s) => {
10
+ i += r + " \"" + o + "\": " + e(t[o], n + 1), s < a.length - 1 && (i += ","), i += "\n";
11
+ }), i += r + "}");
12
+ }
13
+ else if (typeof t == "string") try {
14
+ let r = JSON.parse(t);
15
+ i += e(r, n);
16
+ } catch {
17
+ i += "\"" + t + "\"";
18
+ }
19
+ else i += t;
20
+ return i;
32
21
  };
22
+ //#endregion
23
+ export { e as formatJsonObject };
@@ -1,13 +1,11 @@
1
- import { formatJsonObject as o } from "./formatJsonObject.js";
2
- const e = (t) => {
3
- try {
4
- const r = JSON.parse(t);
5
- return o(r, 0);
6
- } catch (r) {
7
- throw new Error(`Invalid JSON string
8
- ${r}`);
9
- }
10
- };
11
- export {
12
- e as formatJsonString
1
+ import { formatJsonObject as e } from "./formatJsonObject.js";
2
+ //#region src/formats/formatJsonString.ts
3
+ var t = (t) => {
4
+ try {
5
+ return e(JSON.parse(t), 0);
6
+ } catch (e) {
7
+ throw Error(`Invalid JSON string \n ${e}`);
8
+ }
13
9
  };
10
+ //#endregion
11
+ export { t as formatJsonString };
@@ -1,9 +1,6 @@
1
- function a(r) {
2
- return r.split(" ").map((t) => {
3
- const o = t.charAt(0).toUpperCase(), e = t.slice(1).toLowerCase();
4
- return o + e;
5
- }).join(" ");
1
+ //#region src/formats/formatToCapitalizeFirstWordLetter.ts
2
+ function e(e) {
3
+ return e.split(" ").map((e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase()).join(" ");
6
4
  }
7
- export {
8
- a as formatToCapitalizeFirstWordLetter
9
- };
5
+ //#endregion
6
+ export { e as formatToCapitalizeFirstWordLetter };
@@ -1,9 +1,9 @@
1
- import { removeNonNumeric as t } from "../utilities/removeNonNumeric.js";
2
- function m(e) {
3
- const r = t(e).match(/^(\d{5})(\d{3})$/), o = `CEP must be contain 8 numeric digits: ${e}`;
4
- if (!r) throw new Error(o);
5
- return `${r[1]}-${r[2]}`;
1
+ import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
2
+ //#region src/formats/formatToCep.ts
3
+ function t(t) {
4
+ let n = e(t).match(/^(\d{5})(\d{3})$/), r = `CEP must be contain 8 numeric digits: ${t}`;
5
+ if (!n) throw Error(r);
6
+ return `${n[1]}-${n[2]}`;
6
7
  }
7
- export {
8
- m as formatToCep
9
- };
8
+ //#endregion
9
+ export { t as formatToCep };
@@ -1,9 +1,9 @@
1
- import { removeNonNumeric as n } from "../utilities/removeNonNumeric.js";
2
- function m(o) {
3
- const r = n(o).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), e = `CNPJ must be contain 14 numeric digits: ${o}`;
4
- if (!r) throw new Error(e);
5
- return `${r[1]}.${r[2]}.${r[3]}/${r[4]}-${r[5]}`;
1
+ import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
2
+ //#region src/formats/formatToCnpj.ts
3
+ function t(t) {
4
+ let n = e(t).match(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/), r = `CNPJ must be contain 14 numeric digits: ${t}`;
5
+ if (!n) throw Error(r);
6
+ return `${n[1]}.${n[2]}.${n[3]}/${n[4]}-${n[5]}`;
6
7
  }
7
- export {
8
- m as formatToCnpj
9
- };
8
+ //#endregion
9
+ export { t as formatToCnpj };
@@ -1,9 +1,9 @@
1
- import { removeNonNumeric as t } from "../utilities/removeNonNumeric.js";
2
- function m(o) {
3
- const r = t(o).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), e = `CPF must be contain 11 numeric digits: ${o}`;
4
- if (!r) throw new Error(e);
5
- return `${r[1]}.${r[2]}.${r[3]}-${r[4]}`;
1
+ import { removeNonNumeric as e } from "../utilities/removeNonNumeric.js";
2
+ //#region src/formats/formatToCpf.ts
3
+ function t(t) {
4
+ let n = e(t).match(/^(\d{3})(\d{3})(\d{3})(\d{2})$/), r = `CPF must be contain 11 numeric digits: ${t}`;
5
+ if (!n) throw Error(r);
6
+ return `${n[1]}.${n[2]}.${n[3]}-${n[4]}`;
6
7
  }
7
- export {
8
- m as formatToCpf
9
- };
8
+ //#endregion
9
+ export { t as formatToCpf };
@@ -1,15 +1,13 @@
1
- import { countryCurrencies as n } from "@arkyn/templates";
2
- import { removeCurrencySymbols as y } from "../utilities/removeCurrencySymbols.js";
3
- function f(u, e, r) {
4
- var t;
5
- if (!((t = n) != null && t[e]))
6
- throw new Error("Unsupported currency code");
7
- const c = (r == null ? void 0 : r.showPrefix) ?? !0, { countryCurrency: m, countryLanguage: s } = n[e], o = new Intl.NumberFormat(s, {
8
- style: "currency",
9
- currency: m
10
- }).format(u);
11
- return c ? o.replace(/\s/g, " ") : y(o).replace(/\s/g, " ");
1
+ import { removeCurrencySymbols as e } from "../utilities/removeCurrencySymbols.js";
2
+ import { countryCurrencies as t } from "@arkyn/templates";
3
+ //#region src/formats/formatToCurrency.ts
4
+ function n(n, r, i) {
5
+ if (!t?.[r]) throw Error("Unsupported currency code");
6
+ let a = i?.showPrefix ?? !0, { countryCurrency: o, countryLanguage: s } = t[r], c = new Intl.NumberFormat(s, {
7
+ style: "currency",
8
+ currency: o
9
+ }).format(n);
10
+ return a ? c.replace(/\s/g, " ") : e(c).replace(/\s/g, " ");
12
11
  }
13
- export {
14
- f as formatToCurrency
15
- };
12
+ //#endregion
13
+ export { n as formatToCurrency };
@@ -1,11 +1,10 @@
1
- function n(r, e) {
2
- if (r.length > e) {
3
- let t = r.substring(0, e);
4
- const s = t.lastIndexOf(" ");
5
- return s > 0 && (t = t.substring(0, s)), t = t.replace(/[\s.,!?;:]+$/, ""), t.trim().length === 0 || /^[.,!?;:\s]+$/.test(t) ? "..." : `${t}...`;
6
- }
7
- return r;
1
+ //#region src/formats/formatToEllipsis.ts
2
+ function e(e, t) {
3
+ if (e.length > t) {
4
+ let n = e.substring(0, t), r = n.lastIndexOf(" ");
5
+ return r > 0 && (n = n.substring(0, r)), n = n.replace(/[\s.,!?;:]+$/, ""), n.trim().length === 0 || /^[.,!?;:\s]+$/.test(n) ? "..." : `${n}...`;
6
+ }
7
+ return e;
8
8
  }
9
- export {
10
- n as formatToEllipsis
11
- };
9
+ //#endregion
10
+ export { e as formatToEllipsis };
@@ -1,12 +1,22 @@
1
- const n = /^\d$/, a = (t) => {
2
- let r = 0;
3
- const e = t.split("").map((i) => n.test(i) ? { character: i, kind: "digit", digit: ++r } : { character: i, kind: "other" });
4
- return { digits: r, children: e, kind: "root" };
5
- }, c = (t, r) => Array.isArray(t) ? t : t >= 0 ? [0, t] : [r + 1 - Math.abs(t), r], s = (t, r) => r >= t[0] && r <= t[1];
6
- function u(t, r) {
7
- const e = a(t), i = c((r == null ? void 0 : r.range) ?? 3, e.digits);
8
- return e.children.map((d) => d.kind === "digit" && s(i, d.digit) ? (r == null ? void 0 : r.hider) ?? "*" : d.character).join("");
1
+ //#region src/formats/formatToHiddenDigits.ts
2
+ var e = /^\d$/, t = (t) => {
3
+ let n = 0, r = t.split("").map((t) => e.test(t) ? {
4
+ character: t,
5
+ kind: "digit",
6
+ digit: ++n
7
+ } : {
8
+ character: t,
9
+ kind: "other"
10
+ });
11
+ return {
12
+ digits: n,
13
+ children: r,
14
+ kind: "root"
15
+ };
16
+ }, n = (e, t) => Array.isArray(e) ? e : e >= 0 ? [0, e] : [t + 1 - Math.abs(e), t], r = (e, t) => t >= e[0] && t <= e[1];
17
+ function i(e, i) {
18
+ let a = t(e), o = n(i?.range ?? 3, a.digits);
19
+ return a.children.map((e) => e.kind === "digit" && r(o, e.digit) ? i?.hider ?? "*" : e.character).join("");
9
20
  }
10
- export {
11
- u as formatToHiddenDigits
12
- };
21
+ //#endregion
22
+ export { i as formatToHiddenDigits };
@@ -1,17 +1,14 @@
1
- import { parsePhoneNumberWithError as i } from "libphonenumber-js";
2
- import { findCountryMask as a } from "../utilities/findCountryMask.js";
3
- function f(n) {
4
- try {
5
- const o = i(n).nationalNumber.toString();
6
- let r = a(n)[0];
7
- for (let t = 0, e = 0; t < r.length && e < o.length; t++)
8
- r[t] === "_" && (r = r.substring(0, t) + o[e] + r.substring(t + 1), e++);
9
- return r;
10
- } catch (s) {
11
- const o = s;
12
- throw new Error(o.message);
13
- }
1
+ import { findCountryMask as e } from "../utilities/findCountryMask.js";
2
+ import { parsePhoneNumberWithError as t } from "libphonenumber-js";
3
+ //#region src/formats/formatToPhone.ts
4
+ function n(n) {
5
+ try {
6
+ let r = t(n).nationalNumber.toString(), i = e(n)[0];
7
+ for (let e = 0, t = 0; e < i.length && t < r.length; e++) i[e] === "_" && (i = i.substring(0, e) + r[t] + i.substring(e + 1), t++);
8
+ return i;
9
+ } catch (e) {
10
+ throw Error(e.message);
11
+ }
14
12
  }
15
- export {
16
- f as formatToPhone
17
- };
13
+ //#endregion
14
+ export { n as formatToPhone };
@@ -1,9 +1,8 @@
1
- function S(t) {
2
- for (var r = 0, e = 0; e < t.length; e++)
3
- r = t.charCodeAt(e) + ((r << 5) - r);
4
- var a = (r & 16711680) >> 16, n = (r & 65280) >> 8, o = r & 255, v = a.toString(16).padStart(2, "0"), g = n.toString(16).padStart(2, "0"), d = o.toString(16).padStart(2, "0");
5
- return "#" + v + g + d;
1
+ //#region src/generators/generateColorByString.ts
2
+ function e(e) {
3
+ for (var t = 0, n = 0; n < e.length; n++) t = e.charCodeAt(n) + ((t << 5) - t);
4
+ var r = (t & 16711680) >> 16, i = (t & 65280) >> 8, a = t & 255, o = r.toString(16).padStart(2, "0"), s = i.toString(16).padStart(2, "0"), c = a.toString(16).padStart(2, "0");
5
+ return "#" + o + s + c;
6
6
  }
7
- export {
8
- S as generateColorByString
9
- };
7
+ //#endregion
8
+ export { e as generateColorByString };
@@ -1,26 +1,32 @@
1
- import { v4 as o, v7 as f } from "uuid";
2
- function u(n) {
3
- n = n.replace(/-/g, "");
4
- const r = new Uint8Array(n.length / 2);
5
- for (let t = 0; t < n.length; t += 2)
6
- r[t / 2] = parseInt(n.substring(t, t + 2), 16);
7
- return r;
1
+ //#region src/generators/generateId.ts
2
+ function e(e) {
3
+ e = e.replace(/-/g, "");
4
+ let t = new Uint8Array(e.length / 2);
5
+ for (let n = 0; n < e.length; n += 2) t[n / 2] = parseInt(e.substring(n, n + 2), 16);
6
+ return t;
8
7
  }
9
- function i() {
10
- const n = o();
11
- return { text: n, binary: u(n) };
8
+ function t() {
9
+ let t = crypto.randomUUID();
10
+ return {
11
+ text: t,
12
+ binary: e(t)
13
+ };
12
14
  }
13
- function e() {
14
- const n = f();
15
- return { text: n, binary: u(n) };
15
+ function n() {
16
+ let t = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)), n = BigInt(Date.now());
17
+ t[0] = Number(n >> 40n & 255n), t[1] = Number(n >> 32n & 255n), t[2] = Number(n >> 24n & 255n), t[3] = Number(n >> 16n & 255n), t[4] = Number(n >> 8n & 255n), t[5] = Number(n & 255n), t[6] = t[6] & 15 | 112, t[8] = t[8] & 63 | 128;
18
+ let r = [...t].map((e) => e.toString(16).padStart(2, "0")).join("").replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, "$1-$2-$3-$4-$5");
19
+ return {
20
+ text: r,
21
+ binary: e(r)
22
+ };
16
23
  }
17
- function b(n, r) {
18
- if (n === "text" && r === "v4") return i().text;
19
- if (n === "binary" && r === "v4") return i().binary;
20
- if (n === "text" && r === "v7") return e().text;
21
- if (n === "binary" && r === "v7") return e().binary;
22
- throw new Error("Invalid type or format");
24
+ function r(e, r) {
25
+ if (e === "text" && r === "v4") return t().text;
26
+ if (e === "binary" && r === "v4") return t().binary;
27
+ if (e === "text" && r === "v7") return n().text;
28
+ if (e === "binary" && r === "v7") return n().binary;
29
+ throw Error("Invalid type or format");
23
30
  }
24
- export {
25
- b as generateId
26
- };
31
+ //#endregion
32
+ export { r as generateId };
@@ -1,7 +1,7 @@
1
- function l(r) {
2
- let e = r.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
3
- return e = e.replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").toLowerCase(), e = e.replace(/-{2,}/g, "-"), e = e.replace(/^-+|-+$/g, ""), e;
1
+ //#region src/generators/generateSlug.ts
2
+ function e(e) {
3
+ let t = e.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
4
+ return t = t.replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").toLowerCase(), t = t.replace(/-{2,}/g, "-"), t = t.replace(/^-+|-+$/g, ""), t;
4
5
  }
5
- export {
6
- l as generateSlug
7
- };
6
+ //#endregion
7
+ export { e as generateSlug };
@@ -1,52 +1,26 @@
1
- import { formatDate as e } from "./formats/formatDate.js";
2
- import { formatJsonObject as m } from "./formats/formatJsonObject.js";
3
- import { formatJsonString as p } from "./formats/formatJsonString.js";
4
- import { formatToCapitalizeFirstWordLetter as x } from "./formats/formatToCapitalizeFirstWordLetter.js";
5
- import { formatToCep as n } from "./formats/formatToCep.js";
6
- import { formatToCnpj as l } from "./formats/formatToCnpj.js";
7
- import { formatToCpf as g } from "./formats/formatToCpf.js";
8
- import { formatToCurrency as d } from "./formats/formatToCurrency.js";
9
- import { formatToEllipsis as c } from "./formats/formatToEllipsis.js";
10
- import { formatToHiddenDigits as y } from "./formats/formatToHiddenDigits.js";
11
- import { formatToPhone as v } from "./formats/formatToPhone.js";
12
- import { generateColorByString as b } from "./generators/generateColorByString.js";
13
- import { generateId as F } from "./generators/generateId.js";
14
- import { generateSlug as J } from "./generators/generateSlug.js";
15
- import { parseLargeFields as N } from "./parsers/parseLargeFields.js";
16
- import { parseSensitiveData as k } from "./parsers/parseSensitiveData.js";
17
- import { parseToDate as B } from "./parsers/parseToDate.js";
18
- import { ValidateDateService as M } from "./services/validateDateService.js";
19
- import { calculateCardInstallment as P } from "./utilities/calculateCardInstallment.js";
20
- import { ensureQuotes as V } from "./utilities/ensureQuotes.js";
21
- import { findCountryMask as q } from "./utilities/findCountryMask.js";
22
- import { isHtml as A } from "./utilities/isHtml.js";
23
- import { removeCurrencySymbols as K } from "./utilities/removeCurrencySymbols.js";
24
- import { removeNonNumeric as U } from "./utilities/removeNonNumeric.js";
25
- import { stripHtmlTags as Y } from "./utilities/stripHtmlTags.js";
26
- export {
27
- M as ValidateDateService,
28
- P as calculateCardInstallment,
29
- V as ensureQuotes,
30
- q as findCountryMask,
31
- e as formatDate,
32
- m as formatJsonObject,
33
- p as formatJsonString,
34
- x as formatToCapitalizeFirstWordLetter,
35
- n as formatToCep,
36
- l as formatToCnpj,
37
- g as formatToCpf,
38
- d as formatToCurrency,
39
- c as formatToEllipsis,
40
- y as formatToHiddenDigits,
41
- v as formatToPhone,
42
- b as generateColorByString,
43
- F as generateId,
44
- J as generateSlug,
45
- A as isHtml,
46
- N as parseLargeFields,
47
- k as parseSensitiveData,
48
- B as parseToDate,
49
- K as removeCurrencySymbols,
50
- U as removeNonNumeric,
51
- Y as stripHtmlTags
52
- };
1
+ import { ValidateDateService as e } from "./services/validateDateService.js";
2
+ import { formatDate as t } from "./formats/formatDate.js";
3
+ import { formatJsonObject as n } from "./formats/formatJsonObject.js";
4
+ import { formatJsonString as r } from "./formats/formatJsonString.js";
5
+ import { formatToCapitalizeFirstWordLetter as i } from "./formats/formatToCapitalizeFirstWordLetter.js";
6
+ import { removeNonNumeric as a } from "./utilities/removeNonNumeric.js";
7
+ import { formatToCep as o } from "./formats/formatToCep.js";
8
+ import { formatToCnpj as s } from "./formats/formatToCnpj.js";
9
+ import { formatToCpf as c } from "./formats/formatToCpf.js";
10
+ import { removeCurrencySymbols as l } from "./utilities/removeCurrencySymbols.js";
11
+ import { formatToCurrency as u } from "./formats/formatToCurrency.js";
12
+ import { formatToEllipsis as d } from "./formats/formatToEllipsis.js";
13
+ import { formatToHiddenDigits as f } from "./formats/formatToHiddenDigits.js";
14
+ import { findCountryMask as p } from "./utilities/findCountryMask.js";
15
+ import { formatToPhone as m } from "./formats/formatToPhone.js";
16
+ import { generateColorByString as h } from "./generators/generateColorByString.js";
17
+ import { generateId as g } from "./generators/generateId.js";
18
+ import { generateSlug as _ } from "./generators/generateSlug.js";
19
+ import { parseLargeFields as v } from "./parsers/parseLargeFields.js";
20
+ import { parseSensitiveData as y } from "./parsers/parseSensitiveData.js";
21
+ import { parseToDate as b } from "./parsers/parseToDate.js";
22
+ import { calculateCardInstallment as x } from "./utilities/calculateCardInstallment.js";
23
+ import { ensureQuotes as S } from "./utilities/ensureQuotes.js";
24
+ import { isHtml as C } from "./utilities/isHtml.js";
25
+ import { stripHtmlTags as w } from "./utilities/stripHtmlTags.js";
26
+ export { e as ValidateDateService, x as calculateCardInstallment, S as ensureQuotes, p as findCountryMask, t as formatDate, n as formatJsonObject, r as formatJsonString, i as formatToCapitalizeFirstWordLetter, o as formatToCep, s as formatToCnpj, c as formatToCpf, u as formatToCurrency, d as formatToEllipsis, f as formatToHiddenDigits, m as formatToPhone, h as generateColorByString, g as generateId, _ as generateSlug, C as isHtml, v as parseLargeFields, y as parseSensitiveData, b as parseToDate, l as removeCurrencySymbols, a as removeNonNumeric, w as stripHtmlTags };
@@ -1,22 +1,17 @@
1
- function c(n, i = 1e3) {
2
- function s(r) {
3
- return typeof r == "string" && r.length > i ? `To large information: field as ${r.length} characters` : r;
4
- }
5
- function e(r) {
6
- return Array.isArray(r) ? r.map((t) => e(t)) : r !== null && typeof r == "object" ? Object.fromEntries(
7
- Object.entries(r).map(([t, a]) => [
8
- t,
9
- e(a)
10
- ])
11
- ) : s(r);
12
- }
13
- try {
14
- const r = JSON.parse(n), t = e(r);
15
- return JSON.stringify(t);
16
- } catch {
17
- throw new Error("Invalid JSON string");
18
- }
1
+ //#region src/parsers/parseLargeFields.ts
2
+ function e(e, t = 1e3) {
3
+ function n(e) {
4
+ return typeof e == "string" && e.length > t ? `To large information: field as ${e.length} characters` : e;
5
+ }
6
+ function r(e) {
7
+ return Array.isArray(e) ? e.map((e) => r(e)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, r(t)])) : n(e);
8
+ }
9
+ try {
10
+ let t = r(JSON.parse(e));
11
+ return JSON.stringify(t);
12
+ } catch {
13
+ throw Error("Invalid JSON string");
14
+ }
19
15
  }
20
- export {
21
- c as parseLargeFields
22
- };
16
+ //#endregion
17
+ export { e as parseLargeFields };
@@ -1,26 +1,28 @@
1
- function f(i, c = ["password", "confirmPassword", "creditCard"]) {
2
- function u(r, e) {
3
- return c.includes(r) ? "****" : e;
4
- }
5
- function t(r) {
6
- return Array.isArray(r) ? r.map((e) => t(e)) : r !== null && typeof r == "object" ? Object.keys(r).reduce((e, s) => {
7
- let n = r[s];
8
- if (typeof n == "string")
9
- try {
10
- const a = JSON.parse(n);
11
- typeof a == "object" && (n = JSON.stringify(t(a)));
12
- } catch {
13
- }
14
- return e[s] = t(u(s, n)), e;
15
- }, {}) : r;
16
- }
17
- try {
18
- const r = JSON.parse(i), e = t(r);
19
- return JSON.stringify(e);
20
- } catch {
21
- return i;
22
- }
1
+ //#region src/parsers/parseSensitiveData.ts
2
+ function e(e, t = [
3
+ "password",
4
+ "confirmPassword",
5
+ "creditCard"
6
+ ]) {
7
+ function n(e, n) {
8
+ return t.includes(e) ? "****" : n;
9
+ }
10
+ function r(e) {
11
+ return Array.isArray(e) ? e.map((e) => r(e)) : typeof e == "object" && e ? Object.keys(e).reduce((t, i) => {
12
+ let a = e[i];
13
+ if (typeof a == "string") try {
14
+ let e = JSON.parse(a);
15
+ typeof e == "object" && (a = JSON.stringify(r(e)));
16
+ } catch {}
17
+ return t[i] = r(n(i, a)), t;
18
+ }, {}) : e;
19
+ }
20
+ try {
21
+ let t = r(JSON.parse(e));
22
+ return JSON.stringify(t);
23
+ } catch {
24
+ return e;
25
+ }
23
26
  }
24
- export {
25
- f as parseSensitiveData
26
- };
27
+ //#endregion
28
+ export { e as parseSensitiveData };