@arkyn/shared 2.2.14 → 3.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/formats/formatDate.d.ts +3 -1
  2. package/dist/formats/formatDate.d.ts.map +1 -1
  3. package/dist/formats/formatJsonObject.d.ts +1 -1
  4. package/dist/formats/formatJsonObject.d.ts.map +1 -1
  5. package/dist/formats/formatJsonString.d.ts +1 -1
  6. package/dist/formats/formatJsonString.d.ts.map +1 -1
  7. package/dist/formats/formatToCep.d.ts +1 -1
  8. package/dist/formats/formatToCep.d.ts.map +1 -1
  9. package/dist/formats/formatToCnpj.d.ts +1 -1
  10. package/dist/formats/formatToCnpj.d.ts.map +1 -1
  11. package/dist/formats/formatToCpf.d.ts +1 -1
  12. package/dist/formats/formatToCpf.d.ts.map +1 -1
  13. package/dist/formats/formatToCpfCnpj.d.ts +1 -1
  14. package/dist/formats/formatToCpfCnpj.d.ts.map +1 -1
  15. package/dist/formats/formatToCurrency.d.ts +6 -1
  16. package/dist/formats/formatToCurrency.d.ts.map +1 -1
  17. package/dist/formats/formatToDate.d.ts +3 -1
  18. package/dist/formats/formatToDate.d.ts.map +1 -1
  19. package/dist/formats/formatToDate.js +26 -0
  20. package/dist/formats/formatToEllipsis.d.ts +1 -1
  21. package/dist/formats/formatToEllipsis.d.ts.map +1 -1
  22. package/dist/formats/formatToHiddenDigits.d.ts +4 -1
  23. package/dist/formats/formatToHiddenDigits.d.ts.map +1 -1
  24. package/dist/formats/formatToPhone.d.ts +1 -1
  25. package/dist/formats/formatToPhone.d.ts.map +1 -1
  26. package/dist/generators/generateColorByString.d.ts +1 -1
  27. package/dist/generators/generateColorByString.d.ts.map +1 -1
  28. package/dist/services/calculateCardInstallment.d.ts +8 -1
  29. package/dist/services/calculateCardInstallment.d.ts.map +1 -1
  30. package/dist/services/ensureQuotes.d.ts +1 -1
  31. package/dist/services/ensureQuotes.d.ts.map +1 -1
  32. package/dist/services/maskSensitiveData.d.ts +1 -1
  33. package/dist/services/maskSensitiveData.d.ts.map +1 -1
  34. package/dist/services/removeCurrencySymbols.d.ts +2 -1
  35. package/dist/services/removeCurrencySymbols.d.ts.map +1 -1
  36. package/dist/services/removeNonNumeric.d.ts +2 -1
  37. package/dist/services/removeNonNumeric.d.ts.map +1 -1
  38. package/dist/services/removeNonNumeric.js +2 -2
  39. package/dist/services/stripHtmlTags.d.ts +1 -1
  40. package/dist/services/stripHtmlTags.d.ts.map +1 -1
  41. package/dist/services/truncateLargeFields.d.ts +1 -1
  42. package/dist/services/truncateLargeFields.d.ts.map +1 -1
  43. package/dist/validations/validateCep.d.ts +1 -1
  44. package/dist/validations/validateCep.d.ts.map +1 -1
  45. package/dist/validations/validateCnpj.d.ts +1 -1
  46. package/dist/validations/validateCnpj.d.ts.map +1 -1
  47. package/dist/validations/validateCpf.d.ts +1 -1
  48. package/dist/validations/validateCpf.d.ts.map +1 -1
  49. package/dist/validations/validateDate.d.ts +6 -1
  50. package/dist/validations/validateDate.d.ts.map +1 -1
  51. package/dist/validations/validatePassword.d.ts +1 -1
  52. package/dist/validations/validatePassword.d.ts.map +1 -1
  53. package/dist/validations/validatePhone.d.ts +1 -1
  54. package/dist/validations/validatePhone.d.ts.map +1 -1
  55. package/dist/validations/validateRg.d.ts +1 -1
  56. package/dist/validations/validateRg.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/src/formats/formatDate.ts +8 -1
  59. package/src/formats/formatJsonObject.ts +1 -1
  60. package/src/formats/formatJsonString.ts +2 -1
  61. package/src/formats/formatToCep.ts +2 -1
  62. package/src/formats/formatToCnpj.ts +2 -1
  63. package/src/formats/formatToCpf.ts +2 -1
  64. package/src/formats/formatToCpfCnpj.ts +2 -2
  65. package/src/formats/formatToCurrency.ts +12 -2
  66. package/src/formats/formatToDate.ts +8 -1
  67. package/src/formats/formatToEllipsis.ts +1 -1
  68. package/src/formats/formatToHiddenDigits.ts +5 -2
  69. package/src/formats/formatToPhone.ts +11 -1
  70. package/src/generators/generateColorByString.ts +1 -1
  71. package/src/services/calculateCardInstallment.ts +8 -1
  72. package/src/services/ensureQuotes.ts +1 -1
  73. package/src/services/maskSensitiveData.ts +4 -1
  74. package/src/services/removeCurrencySymbols.ts +5 -1
  75. package/src/services/removeNonNumeric.ts +4 -2
  76. package/src/services/stripHtmlTags.ts +1 -1
  77. package/src/services/truncateLargeFields.ts +4 -1
  78. package/src/validations/validateCep.ts +2 -1
  79. package/src/validations/validateCnpj.ts +2 -1
  80. package/src/validations/validateCpf.ts +2 -1
  81. package/src/validations/validateDate.ts +10 -1
  82. package/src/validations/validatePassword.ts +1 -1
  83. package/src/validations/validatePhone.ts +2 -1
  84. package/src/validations/validateRg.ts +1 -1
@@ -1,4 +1,6 @@
1
- import type { FormatDateFunction } from "@arkyn/types";
1
+ type InputFormatTypes = "brazilianDate" | "isoDate" | "timestamp";
2
+ type FormatDateFunction = (date: string[], // [date: string, time?: string]
3
+ inputFormat: InputFormatTypes, outputFormat: string, timezone?: number) => string;
2
4
  /**
3
5
  * Formats a date and time string based on the provided input and output formats.
4
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAqBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,UAAU,EAAE,kBAgCjB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,CAAC;AAElE,KAAK,kBAAkB,GAAG,CACxB,IAAI,EAAE,MAAM,EAAE,EAAE,gCAAgC;AAChD,WAAW,EAAE,gBAAgB,EAC7B,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,MAAM,KACd,MAAM,CAAC;AAqBZ;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,UAAU,EAAE,kBAgCjB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatJsonObjectFunction } from "@arkyn/types";
1
+ type FormatJsonObjectFunction = (jsonString: any, identLevel: number) => string;
2
2
  /**
3
3
  * Formats a JSON object into a human-readable string with proper indentation.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatJsonObject.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAuDvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatJsonObject.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonObject.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAuDvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatJsonStringFunction } from "@arkyn/types";
1
+ type FormatJsonStringFunction = (jsonString: string) => string;
2
2
  /**
3
3
  * Formats a JSON string into a more readable format.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatJsonString.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAOvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatJsonString.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonString.ts"],"names":[],"mappings":"AAEA,KAAK,wBAAwB,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAOvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatToCepFunction } from "@arkyn/types";
1
+ type FormatToCepFunction = (value: string) => string;
2
2
  /**
3
3
  * Formats a given string into a Brazilian postal code (CEP) format.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToCep.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAMlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToCep.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCep.ts"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAMlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatToCnpjFunction } from "@arkyn/types";
1
+ type FormatToCnpjFunction = (value: string) => string;
2
2
  /**
3
3
  * Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCnpj.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBAMnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCnpj.ts"],"names":[],"mappings":"AAEA,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBAMnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatToCpfFunction } from "@arkyn/types";
1
+ type FormatToCpfFunction = (value: string) => string;
2
2
  /**
3
3
  * Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToCpf.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAMlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToCpf.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpf.ts"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAMlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatToCpfCnpjFunction } from "@arkyn/types";
1
+ type FormatToCpfCnpjFunction = (value: string) => string;
2
2
  /**
3
3
  * Formats a given string value into either a CPF or CNPJ format based on its length.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToCpfCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpfCnpj.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAK5D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,QAAA,MAAM,eAAe,EAAE,uBAStB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToCpfCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpfCnpj.ts"],"names":[],"mappings":"AAGA,KAAK,uBAAuB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,QAAA,MAAM,eAAe,EAAE,uBAStB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,4 +1,9 @@
1
- import type { FormatToCurrency } from "@arkyn/types";
1
+ import { countryCurrencies } from "@arkyn/templates";
2
+ type Currencies = keyof typeof countryCurrencies;
3
+ type Config = {
4
+ showPrefix?: boolean;
5
+ };
6
+ type FormatToCurrency = (value: number, currency: Currencies, config?: Config) => string;
2
7
  /**
3
8
  * Formats a numeric value into a currency string based on the specified currency and configuration.
4
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToCurrency.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCurrency.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,gBAAgB,EAAE,gBAmBvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
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,KAAK,MAAM,GAAG;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,gBAAgB,GAAG,CACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE,MAAM,KACZ,MAAM,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,gBAAgB,EAAE,gBAmBvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,3 +1,6 @@
1
+ type InputFormatTypes = "brazilianDate" | "timestamp" | "isoDate";
2
+ type FormatToDateFunction = (date: string[], // [date: string, time?: string]
3
+ inputFormat: InputFormatTypes, timezone?: number) => Date;
1
4
  /**
2
5
  * Converts a date and time input into a JavaScript `Date` object, formatted according to the specified input format and timezone.
3
6
  *
@@ -24,7 +27,6 @@
24
27
  * console.log(date); // Outputs a Date object for "2023-12-25T18:30:00.000Z" (UTC)
25
28
  * ```
26
29
  */
27
- import type { FormatToDateFunction } from "@arkyn/types";
28
30
  declare const formatToDate: FormatToDateFunction;
29
31
  export { formatToDate };
30
32
  //# sourceMappingURL=formatToDate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatToDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatToDate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,QAAA,MAAM,YAAY,EAAE,oBAgCnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatToDate.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,eAAe,GAAG,WAAW,GAAG,SAAS,CAAC;AAElE,KAAK,oBAAoB,GAAG,CAC1B,IAAI,EAAE,MAAM,EAAE,EAAE,gCAAgC;AAChD,WAAW,EAAE,gBAAgB,EAC7B,QAAQ,CAAC,EAAE,MAAM,KACd,IAAI,CAAC;AAEV;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBAgCnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,3 +1,29 @@
1
+ /**
2
+ * Converts a date and time input into a JavaScript `Date` object, formatted according to the specified input format and timezone.
3
+ *
4
+ * @param param0 - A tuple containing the date string and an optional time string.
5
+ * The date string format depends on the `inputFormat` parameter.
6
+ * The time string defaults to "00:00:00" if not provided.
7
+ * @param inputFormat - The format of the input date string.
8
+ * Supported formats are:
9
+ * - `"brazilianDate"`: Expects the date in `DD/MM/YYYY` format.
10
+ * - `"isoDate"`: Expects the date in `YYYY-MM-DD` format.
11
+ * - `"timestamp"`: Expects the date in `YYYY-MM-DD` format (similar to `isoDate`).
12
+ * @param timezone - An optional timezone offset in hours. Defaults to `0` (UTC).
13
+ *
14
+ * @returns A `Date` object representing the parsed date and time, adjusted for the specified timezone.
15
+ *
16
+ * @throws {Error} If the `inputFormat` is invalid.
17
+ * @throws {Error} If the provided date or time is invalid.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { formatToDate } from "./formatToIsoDate";
22
+ *
23
+ * const date = formatToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
24
+ * console.log(date); // Outputs a Date object for "2023-12-25T18:30:00.000Z" (UTC)
25
+ * ```
26
+ */
1
27
  const formatToDate = ([date, time = "00:00:00"], inputFormat, timezone = 0) => {
2
28
  const dateParts = date.split(/[-/]/).map(Number);
3
29
  const timeParts = time.split(".")[0].split(":").map(Number);
@@ -1,4 +1,4 @@
1
- import type { FormatToEllipsisFunction } from "@arkyn/types";
1
+ type FormatToEllipsisFunction = (value: string, maxLength: number) => string;
2
2
  /**
3
3
  * Truncates a given text to a specified maximum length and appends an ellipsis ("...")
4
4
  * if the text exceeds the maximum length.
@@ -1 +1 @@
1
- {"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAOvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;AAE7E;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAOvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,7 @@
1
- import type { FormatToHiddenDigitsFunction } from "@arkyn/types";
1
+ type FormatToHiddenDigitsFunction = (value: string, options: {
2
+ range?: number | [number, number];
3
+ hider?: string;
4
+ }) => string;
2
5
  /**
3
6
  * Formats a string by hiding specific digits within a given range.
4
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AA+CjE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,oBAAoB,EAAE,4BAU3B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AAmBA,KAAK,4BAA4B,GAAG,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3D,MAAM,CAAC;AA4BZ;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,oBAAoB,EAAE,4BAU3B,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { FormatToPhoneFunction } from "@arkyn/types";
1
+ type FormatToPhoneFunction = (prop: string) => string;
2
2
  /**
3
3
  * Formats a phone number string based on the provided country code and optional prefix.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAqGvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAwBpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"AAaA,KAAK,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAmGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAwBpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { GenerateColorByStringFunction } from "@arkyn/types";
1
+ type GenerateColorByStringFunction = (prop: string) => string;
2
2
  /**
3
3
  * Generates a hexadecimal color code based on the input string.
4
4
  * The function creates a hash from the string and uses it to calculate
@@ -1 +1 @@
1
- {"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAElE;;;;;;;;;;GAUG;AAEH,QAAA,MAAM,qBAAqB,EAAE,6BAgB5B,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA,KAAK,6BAA6B,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAE9D;;;;;;;;;;GAUG;AAEH,QAAA,MAAM,qBAAqB,EAAE,6BAgB5B,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,4 +1,11 @@
1
- import type { CalculateCardInstallmentFunction } from "@arkyn/types";
1
+ type CalculateCardInstallmentFunction = (props: {
2
+ cashPrice: number;
3
+ numberInstallments: number;
4
+ fees?: number;
5
+ }) => {
6
+ totalPrice: number;
7
+ installmentPrice: number;
8
+ };
2
9
  /**
3
10
  * Calculates the installment price and total price for a card payment plan.
4
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"calculateCardInstallment.d.ts","sourceRoot":"","sources":["../../src/services/calculateCardInstallment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,QAAA,MAAM,wBAAwB,EAAE,gCA+B/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"calculateCardInstallment.d.ts","sourceRoot":"","sources":["../../src/services/calculateCardInstallment.ts"],"names":[],"mappings":"AAAA,KAAK,gCAAgC,GAAG,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,KAAK;IACJ,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,QAAA,MAAM,wBAAwB,EAAE,gCA+B/B,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { EnsureQuotesFunction } from "@arkyn/types";
1
+ type EnsureQuotesFunction = (rawValue: string) => string;
2
2
  /**
3
3
  * Ensures that a given rawValue string is enclosed in quotes.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ensureQuotes.d.ts","sourceRoot":"","sources":["../../src/services/ensureQuotes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;GASG;AAEH,QAAA,MAAM,YAAY,EAAE,oBASnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"ensureQuotes.d.ts","sourceRoot":"","sources":["../../src/services/ensureQuotes.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;AAEzD;;;;;;;;;GASG;AAEH,QAAA,MAAM,YAAY,EAAE,oBASnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { MaskSensitiveDataFunction } from "@arkyn/types";
1
+ type MaskSensitiveDataFunction = (jsonString: string, sensitiveKeys?: string[]) => string;
2
2
  /**
3
3
  * Masks sensitive data in a JSON string by replacing the values of specified keys with "****".
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"maskSensitiveData.d.ts","sourceRoot":"","sources":["../../src/services/maskSensitiveData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,QAAA,MAAM,iBAAiB,EAAE,yBAqCxB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"maskSensitiveData.d.ts","sourceRoot":"","sources":["../../src/services/maskSensitiveData.ts"],"names":[],"mappings":"AAAA,KAAK,yBAAyB,GAAG,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,EAAE,KACrB,MAAM,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,QAAA,MAAM,iBAAiB,EAAE,yBAqCxB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ type RemoveCurrencySymbolsFunction = (formattedValue: string) => string;
1
2
  /**
2
3
  * Removes currency symbols from a given formatted string.
3
4
  *
@@ -15,6 +16,6 @@
15
16
  * removeCurrencySymbols("¥1,000"); // "1,000"
16
17
  * removeCurrencySymbols("123.45"); // "123.45" (no symbols to remove)
17
18
  */
18
- declare const removeCurrencySymbols: (formattedValue: string) => string;
19
+ declare const removeCurrencySymbols: RemoveCurrencySymbolsFunction;
19
20
  export { removeCurrencySymbols };
20
21
  //# sourceMappingURL=removeCurrencySymbols.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeCurrencySymbols.d.ts","sourceRoot":"","sources":["../../src/services/removeCurrencySymbols.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,qBAAqB,GAAI,gBAAgB,MAAM,KAAG,MAIvD,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"removeCurrencySymbols.d.ts","sourceRoot":"","sources":["../../src/services/removeCurrencySymbols.ts"],"names":[],"mappings":"AAAA,KAAK,6BAA6B,GAAG,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;AAExE;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,qBAAqB,EAAE,6BAM5B,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
+ type RemoveNonNumericFunction = (formattedValue: string) => string;
1
2
  /**
2
3
  * Removes all non-numeric characters from a given string.
3
4
  *
@@ -10,6 +11,6 @@
10
11
  * console.log(result); // Output: "123456"
11
12
  * ```
12
13
  */
13
- declare function removeNonNumeric(prop: string): string;
14
+ declare const removeNonNumeric: RemoveNonNumericFunction;
14
15
  export { removeNonNumeric };
15
16
  //# sourceMappingURL=removeNonNumeric.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"removeNonNumeric.d.ts","sourceRoot":"","sources":["../../src/services/removeNonNumeric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"removeNonNumeric.d.ts","sourceRoot":"","sources":["../../src/services/removeNonNumeric.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;AAEnE;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAEvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -10,7 +10,7 @@
10
10
  * console.log(result); // Output: "123456"
11
11
  * ```
12
12
  */
13
- function removeNonNumeric(prop) {
13
+ const removeNonNumeric = (prop) => {
14
14
  return prop.replace(/[^0-9]/g, "");
15
- }
15
+ };
16
16
  export { removeNonNumeric };
@@ -1,4 +1,4 @@
1
- import type { StripHtmlTagsFunction } from "@arkyn/types";
1
+ type StripHtmlTagsFunction = (rawHtml: string) => string;
2
2
  /**
3
3
  * Strips HTML tags from a string.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"stripHtmlTags.d.ts","sourceRoot":"","sources":["../../src/services/stripHtmlTags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAEpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"stripHtmlTags.d.ts","sourceRoot":"","sources":["../../src/services/stripHtmlTags.ts"],"names":[],"mappings":"AAAA,KAAK,qBAAqB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;AAEzD;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAEpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { TruncateLargeFieldsFunction } from "@arkyn/types";
1
+ type TruncateLargeFieldsFunction = (jsonString: string, maxLength?: number) => string;
2
2
  /**
3
3
  * Truncates large string fields in a JSON string to a specified maximum length.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"truncateLargeFields.d.ts","sourceRoot":"","sources":["../../src/services/truncateLargeFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,mBAAmB,EAAE,2BAgC1B,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"truncateLargeFields.d.ts","sourceRoot":"","sources":["../../src/services/truncateLargeFields.ts"],"names":[],"mappings":"AAAA,KAAK,2BAA2B,GAAG,CACjC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,KACf,MAAM,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,mBAAmB,EAAE,2BAgC1B,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidateCepFunction } from "@arkyn/types";
1
+ type ValidateCepFunction = (rawCep: string) => boolean;
2
2
  /**
3
3
  * Removes all non-digit characters from the CEP.
4
4
  * @param cep - Raw CEP string.
@@ -1 +1 @@
1
- {"version":3,"file":"validateCep.d.ts","sourceRoot":"","sources":["../../src/validations/validateCep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAYlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"validateCep.d.ts","sourceRoot":"","sources":["../../src/validations/validateCep.ts"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;AAEvD;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAYlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidateCnpjFunction } from "@arkyn/types";
1
+ type ValidateCnpjFunction = (rawCnpj: string) => boolean;
2
2
  /**
3
3
  * Validates a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) number.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validateCnpj.d.ts","sourceRoot":"","sources":["../../src/validations/validateCnpj.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA0BzD;;;;;;;;;;;;;;;;;GAiBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBAgBnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"validateCnpj.d.ts","sourceRoot":"","sources":["../../src/validations/validateCnpj.ts"],"names":[],"mappings":"AAEA,KAAK,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;AAyBzD;;;;;;;;;;;;;;;;;GAiBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBAgBnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidateCpfFunction } from "@arkyn/types";
1
+ type ValidateCpfFunction = (rawCpf: string) => boolean;
2
2
  /**
3
3
  * Validates a Brazilian CPF (Cadastro de Pessoas Físicas) number.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validateCpf.d.ts","sourceRoot":"","sources":["../../src/validations/validateCpf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA0BxD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAWlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"validateCpf.d.ts","sourceRoot":"","sources":["../../src/validations/validateCpf.ts"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;AAyBvD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,QAAA,MAAM,WAAW,EAAE,mBAWlB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,4 +1,9 @@
1
- import type { ValidateDateFunction } from "@arkyn/types";
1
+ type ValidateDateConfig = {
2
+ inputFormat?: "DD/MM/YYYY" | "MM-DD-YYYY" | "YYYY-MM-DD";
3
+ minYear?: number;
4
+ maxYear?: number;
5
+ };
6
+ type ValidateDateFunction = (rawDate: string, config?: ValidateDateConfig) => boolean;
2
7
  /**
3
8
  * Validates a date string based on the provided format and configuration.
4
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validateDate.d.ts","sourceRoot":"","sources":["../../src/validations/validateDate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBA8CnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"validateDate.d.ts","sourceRoot":"","sources":["../../src/validations/validateDate.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,GAAG;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,oBAAoB,GAAG,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,kBAAkB,KACxB,OAAO,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,YAAY,EAAE,oBA8CnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidatePasswordFunction } from "@arkyn/types";
1
+ type ValidatePasswordFunction = (rawPassword: string) => boolean;
2
2
  /**
3
3
  * Validates a password based on the following rules:
4
4
  * - At least 8 characters
@@ -1 +1 @@
1
- {"version":3,"file":"validatePassword.d.ts","sourceRoot":"","sources":["../../src/validations/validatePassword.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAkBvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"validatePassword.d.ts","sourceRoot":"","sources":["../../src/validations/validatePassword.ts"],"names":[],"mappings":"AAAA,KAAK,wBAAwB,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;AAEjE;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAkBvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidatePhoneFunction } from "@arkyn/types";
1
+ type ValidatePhoneFunction = (rawPhone: string) => boolean;
2
2
  /**
3
3
  * Validates a phone number against a list of country-specific formats.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validatePhone.d.ts","sourceRoot":"","sources":["../../src/validations/validatePhone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAiBpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"validatePhone.d.ts","sourceRoot":"","sources":["../../src/validations/validatePhone.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,QAAA,MAAM,aAAa,EAAE,qBAiBpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ValidateRgFunction } from "@arkyn/types";
1
+ type ValidateRgFunction = (rawRg: string) => boolean;
2
2
  /**
3
3
  * Validates a Brazilian RG (Registro Geral) in a generic way.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"validateRg.d.ts","sourceRoot":"","sources":["../../src/validations/validateRg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AAEH,QAAA,MAAM,UAAU,EAAE,kBAajB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"validateRg.d.ts","sourceRoot":"","sources":["../../src/validations/validateRg.ts"],"names":[],"mappings":"AAAA,KAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AAEH,QAAA,MAAM,UAAU,EAAE,kBAajB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/shared",
3
- "version": "2.2.14",
3
+ "version": "3.0.1-beta.0",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./src/index.ts",
6
6
  "type": "module",
@@ -1,4 +1,11 @@
1
- import type { FormatDateFunction } from "@arkyn/types";
1
+ type InputFormatTypes = "brazilianDate" | "isoDate" | "timestamp";
2
+
3
+ type FormatDateFunction = (
4
+ date: string[], // [date: string, time?: string]
5
+ inputFormat: InputFormatTypes,
6
+ outputFormat: string,
7
+ timezone?: number
8
+ ) => string;
2
9
 
3
10
  function formatDateString(date: Date, format: string): string {
4
11
  const pad = (num: number) => num.toString().padStart(2, "0");
@@ -1,4 +1,4 @@
1
- import type { FormatJsonObjectFunction } from "@arkyn/types";
1
+ type FormatJsonObjectFunction = (jsonString: any, identLevel: number) => string;
2
2
 
3
3
  /**
4
4
  * Formats a JSON object into a human-readable string with proper indentation.
@@ -1,6 +1,7 @@
1
- import type { FormatJsonStringFunction } from "@arkyn/types";
2
1
  import { formatJsonObject } from "./formatJsonObject";
3
2
 
3
+ type FormatJsonStringFunction = (jsonString: string) => string;
4
+
4
5
  /**
5
6
  * Formats a JSON string into a more readable format.
6
7
  *
@@ -1,6 +1,7 @@
1
- import type { FormatToCepFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type FormatToCepFunction = (value: string) => string;
4
+
4
5
  /**
5
6
  * Formats a given string into a Brazilian postal code (CEP) format.
6
7
  *
@@ -1,6 +1,7 @@
1
- import type { FormatToCnpjFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type FormatToCnpjFunction = (value: string) => string;
4
+
4
5
  /**
5
6
  * Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.
6
7
  *
@@ -1,6 +1,7 @@
1
- import type { FormatToCpfFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type FormatToCpfFunction = (value: string) => string;
4
+
4
5
  /**
5
6
  * Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.
6
7
  *
@@ -1,8 +1,8 @@
1
- import type { FormatToCpfCnpjFunction } from "@arkyn/types";
2
-
3
1
  import { formatToCnpj } from "./formatToCnpj";
4
2
  import { formatToCpf } from "./formatToCpf";
5
3
 
4
+ type FormatToCpfCnpjFunction = (value: string) => string;
5
+
6
6
  /**
7
7
  * Formats a given string value into either a CPF or CNPJ format based on its length.
8
8
  *
@@ -1,8 +1,18 @@
1
1
  import { countryCurrencies } from "@arkyn/templates";
2
- import type { FormatToCurrency } from "@arkyn/types";
3
-
4
2
  import { removeCurrencySymbols } from "../services/removeCurrencySymbols";
5
3
 
4
+ type Currencies = keyof typeof countryCurrencies;
5
+
6
+ type Config = {
7
+ showPrefix?: boolean;
8
+ };
9
+
10
+ type FormatToCurrency = (
11
+ value: number,
12
+ currency: Currencies,
13
+ config?: Config
14
+ ) => string;
15
+
6
16
  /**
7
17
  * Formats a numeric value into a currency string based on the specified currency and configuration.
8
18
  *
@@ -1,3 +1,11 @@
1
+ type InputFormatTypes = "brazilianDate" | "timestamp" | "isoDate";
2
+
3
+ type FormatToDateFunction = (
4
+ date: string[], // [date: string, time?: string]
5
+ inputFormat: InputFormatTypes,
6
+ timezone?: number
7
+ ) => Date;
8
+
1
9
  /**
2
10
  * Converts a date and time input into a JavaScript `Date` object, formatted according to the specified input format and timezone.
3
11
  *
@@ -24,7 +32,6 @@
24
32
  * console.log(date); // Outputs a Date object for "2023-12-25T18:30:00.000Z" (UTC)
25
33
  * ```
26
34
  */
27
- import type { FormatToDateFunction } from "@arkyn/types";
28
35
 
29
36
  const formatToDate: FormatToDateFunction = (
30
37
  [date, time = "00:00:00"],
@@ -1,4 +1,4 @@
1
- import type { FormatToEllipsisFunction } from "@arkyn/types";
1
+ type FormatToEllipsisFunction = (value: string, maxLength: number) => string;
2
2
 
3
3
  /**
4
4
  * Truncates a given text to a specified maximum length and appends an ellipsis ("...")
@@ -1,5 +1,3 @@
1
- import type { FormatToHiddenDigitsFunction } from "@arkyn/types";
2
-
3
1
  const DIGIT = /^\d$/;
4
2
 
5
3
  type DigitCharacterNode = {
@@ -19,6 +17,11 @@ type RootCharacterNode = {
19
17
  children: (DigitCharacterNode | OtherCharacterNode)[];
20
18
  };
21
19
 
20
+ type FormatToHiddenDigitsFunction = (
21
+ value: string,
22
+ options: { range?: number | [number, number]; hider?: string }
23
+ ) => string;
24
+
22
25
  const parseToCharacters = (value: string): RootCharacterNode => {
23
26
  let digits = 0;
24
27
 
@@ -1,8 +1,18 @@
1
1
  import { countries } from "@arkyn/templates";
2
- import type { CountryType, FormatToPhoneFunction } from "@arkyn/types";
3
2
 
4
3
  import { removeNonNumeric } from "../services/removeNonNumeric";
5
4
 
5
+ type CountryType = {
6
+ name: string;
7
+ code: string;
8
+ iso: string;
9
+ prefix: null | string;
10
+ flag: string;
11
+ mask: string;
12
+ };
13
+
14
+ type FormatToPhoneFunction = (prop: string) => string;
15
+
6
16
  function getMask(value: string): "NINE" | "EIGTH" {
7
17
  const mask = value.length > 10 ? "NINE" : "EIGTH";
8
18
  return mask;
@@ -1,4 +1,4 @@
1
- import type { GenerateColorByStringFunction } from "@arkyn/types";
1
+ type GenerateColorByStringFunction = (prop: string) => string;
2
2
 
3
3
  /**
4
4
  * Generates a hexadecimal color code based on the input string.
@@ -1,4 +1,11 @@
1
- import type { CalculateCardInstallmentFunction } from "@arkyn/types";
1
+ type CalculateCardInstallmentFunction = (props: {
2
+ cashPrice: number;
3
+ numberInstallments: number;
4
+ fees?: number;
5
+ }) => {
6
+ totalPrice: number;
7
+ installmentPrice: number;
8
+ };
2
9
 
3
10
  /**
4
11
  * Calculates the installment price and total price for a card payment plan.
@@ -1,4 +1,4 @@
1
- import type { EnsureQuotesFunction } from "@arkyn/types";
1
+ type EnsureQuotesFunction = (rawValue: string) => string;
2
2
 
3
3
  /**
4
4
  * Ensures that a given rawValue string is enclosed in quotes.
@@ -1,4 +1,7 @@
1
- import type { MaskSensitiveDataFunction } from "@arkyn/types";
1
+ type MaskSensitiveDataFunction = (
2
+ jsonString: string,
3
+ sensitiveKeys?: string[]
4
+ ) => string;
2
5
 
3
6
  /**
4
7
  * Masks sensitive data in a JSON string by replacing the values of specified keys with "****".
@@ -1,3 +1,5 @@
1
+ type RemoveCurrencySymbolsFunction = (formattedValue: string) => string;
2
+
1
3
  /**
2
4
  * Removes currency symbols from a given formatted string.
3
5
  *
@@ -16,7 +18,9 @@
16
18
  * removeCurrencySymbols("123.45"); // "123.45" (no symbols to remove)
17
19
  */
18
20
 
19
- const removeCurrencySymbols = (formattedValue: string): string => {
21
+ const removeCurrencySymbols: RemoveCurrencySymbolsFunction = (
22
+ formattedValue
23
+ ) => {
20
24
  return formattedValue
21
25
  .replace(/(?:R\$|\p{Sc}|[$€¥£])/gu, "") // Inclui "R$" e outros símbolos comuns
22
26
  .trim();
@@ -1,3 +1,5 @@
1
+ type RemoveNonNumericFunction = (formattedValue: string) => string;
2
+
1
3
  /**
2
4
  * Removes all non-numeric characters from a given string.
3
5
  *
@@ -11,8 +13,8 @@
11
13
  * ```
12
14
  */
13
15
 
14
- function removeNonNumeric(prop: string): string {
16
+ const removeNonNumeric: RemoveNonNumericFunction = (prop) => {
15
17
  return prop.replace(/[^0-9]/g, "");
16
- }
18
+ };
17
19
 
18
20
  export { removeNonNumeric };
@@ -1,4 +1,4 @@
1
- import type { StripHtmlTagsFunction } from "@arkyn/types";
1
+ type StripHtmlTagsFunction = (rawHtml: string) => string;
2
2
 
3
3
  /**
4
4
  * Strips HTML tags from a string.
@@ -1,4 +1,7 @@
1
- import type { TruncateLargeFieldsFunction } from "@arkyn/types";
1
+ type TruncateLargeFieldsFunction = (
2
+ jsonString: string,
3
+ maxLength?: number
4
+ ) => string;
2
5
 
3
6
  /**
4
7
  * Truncates large string fields in a JSON string to a specified maximum length.
@@ -1,6 +1,7 @@
1
- import type { ValidateCepFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type ValidateCepFunction = (rawCep: string) => boolean;
4
+
4
5
  /**
5
6
  * Removes all non-digit characters from the CEP.
6
7
  * @param cep - Raw CEP string.
@@ -1,6 +1,7 @@
1
- import type { ValidateCnpjFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type ValidateCnpjFunction = (rawCnpj: string) => boolean;
4
+
4
5
  function isInvalidLength(cnpj: string) {
5
6
  const CNPJ_LENGTH = 14;
6
7
  return cnpj.length !== CNPJ_LENGTH;
@@ -1,6 +1,7 @@
1
- import type { ValidateCpfFunction } from "@arkyn/types";
2
1
  import { removeNonNumeric } from "../services/removeNonNumeric";
3
2
 
3
+ type ValidateCpfFunction = (rawCpf: string) => boolean;
4
+
4
5
  function isInvalidLength(cpf: string) {
5
6
  const CPF_LENGTH = 11;
6
7
  return cpf.length !== CPF_LENGTH;
@@ -1,4 +1,13 @@
1
- import type { ValidateDateFunction } from "@arkyn/types";
1
+ type ValidateDateConfig = {
2
+ inputFormat?: "DD/MM/YYYY" | "MM-DD-YYYY" | "YYYY-MM-DD";
3
+ minYear?: number;
4
+ maxYear?: number;
5
+ };
6
+
7
+ type ValidateDateFunction = (
8
+ rawDate: string,
9
+ config?: ValidateDateConfig
10
+ ) => boolean;
2
11
 
3
12
  /**
4
13
  * Validates a date string based on the provided format and configuration.
@@ -1,4 +1,4 @@
1
- import type { ValidatePasswordFunction } from "@arkyn/types";
1
+ type ValidatePasswordFunction = (rawPassword: string) => boolean;
2
2
 
3
3
  /**
4
4
  * Validates a password based on the following rules:
@@ -1,5 +1,6 @@
1
1
  import { countries } from "@arkyn/templates";
2
- import type { ValidatePhoneFunction } from "@arkyn/types";
2
+
3
+ type ValidatePhoneFunction = (rawPhone: string) => boolean;
3
4
 
4
5
  /**
5
6
  * Validates a phone number against a list of country-specific formats.
@@ -1,4 +1,4 @@
1
- import type { ValidateRgFunction } from "@arkyn/types";
1
+ type ValidateRgFunction = (rawRg: string) => boolean;
2
2
 
3
3
  /**
4
4
  * Validates a Brazilian RG (Registro Geral) in a generic way.