@arkyn/shared 3.0.1-beta.143 → 3.0.1-beta.144

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 (76) hide show
  1. package/dist/bundle.js +6 -36
  2. package/dist/formats/formatDate.d.ts +16 -52
  3. package/dist/formats/formatDate.d.ts.map +1 -1
  4. package/dist/formats/formatDate.js +15 -51
  5. package/dist/formats/formatJsonObject.d.ts +3 -4
  6. package/dist/formats/formatJsonObject.d.ts.map +1 -1
  7. package/dist/formats/formatJsonObject.js +3 -4
  8. package/dist/formats/formatJsonString.d.ts +5 -21
  9. package/dist/formats/formatJsonString.d.ts.map +1 -1
  10. package/dist/formats/formatJsonString.js +5 -21
  11. package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts +5 -24
  12. package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts.map +1 -1
  13. package/dist/formats/formatToCapitalizeFirstWordLetter.js +5 -24
  14. package/dist/formats/formatToCep.d.ts +2 -3
  15. package/dist/formats/formatToCep.d.ts.map +1 -1
  16. package/dist/formats/formatToCep.js +2 -3
  17. package/dist/formats/formatToCnpj.d.ts +2 -3
  18. package/dist/formats/formatToCnpj.d.ts.map +1 -1
  19. package/dist/formats/formatToCnpj.js +2 -3
  20. package/dist/formats/formatToCpf.d.ts +2 -3
  21. package/dist/formats/formatToCpf.d.ts.map +1 -1
  22. package/dist/formats/formatToCpf.js +2 -3
  23. package/dist/formats/formatToCurrency.d.ts +8 -25
  24. package/dist/formats/formatToCurrency.d.ts.map +1 -1
  25. package/dist/formats/formatToCurrency.js +8 -25
  26. package/dist/formats/formatToEllipsis.d.ts +3 -6
  27. package/dist/formats/formatToEllipsis.d.ts.map +1 -1
  28. package/dist/formats/formatToEllipsis.js +3 -6
  29. package/dist/formats/formatToHiddenDigits.d.ts +11 -22
  30. package/dist/formats/formatToHiddenDigits.d.ts.map +1 -1
  31. package/dist/formats/formatToHiddenDigits.js +11 -22
  32. package/dist/formats/formatToPhone.d.ts +2 -3
  33. package/dist/formats/formatToPhone.d.ts.map +1 -1
  34. package/dist/formats/formatToPhone.js +2 -3
  35. package/dist/generators/generateColorByString.d.ts +2 -3
  36. package/dist/generators/generateColorByString.d.ts.map +1 -1
  37. package/dist/generators/generateColorByString.js +2 -3
  38. package/dist/generators/generateId.d.ts +8 -19
  39. package/dist/generators/generateId.d.ts.map +1 -1
  40. package/dist/generators/generateSlug.d.ts +2 -3
  41. package/dist/generators/generateSlug.d.ts.map +1 -1
  42. package/dist/generators/generateSlug.js +2 -3
  43. package/dist/parsers/parseLargeFields.d.ts +3 -4
  44. package/dist/parsers/parseLargeFields.d.ts.map +1 -1
  45. package/dist/parsers/parseLargeFields.js +3 -4
  46. package/dist/parsers/parseSensitiveData.d.ts +3 -4
  47. package/dist/parsers/parseSensitiveData.d.ts.map +1 -1
  48. package/dist/parsers/parseSensitiveData.js +3 -4
  49. package/dist/parsers/parseToDate.d.ts +16 -32
  50. package/dist/parsers/parseToDate.d.ts.map +1 -1
  51. package/dist/parsers/parseToDate.js +16 -32
  52. package/dist/services/validateDateService.d.ts +13 -64
  53. package/dist/services/validateDateService.d.ts.map +1 -1
  54. package/dist/services/validateDateService.js +13 -64
  55. package/dist/utilities/calculateCardInstallment.d.ts +8 -21
  56. package/dist/utilities/calculateCardInstallment.d.ts.map +1 -1
  57. package/dist/utilities/calculateCardInstallment.js +8 -21
  58. package/dist/utilities/ensureQuotes.d.ts +2 -3
  59. package/dist/utilities/ensureQuotes.d.ts.map +1 -1
  60. package/dist/utilities/ensureQuotes.js +2 -3
  61. package/dist/utilities/findCountryMask.d.ts +10 -34
  62. package/dist/utilities/findCountryMask.d.ts.map +1 -1
  63. package/dist/utilities/findCountryMask.js +10 -34
  64. package/dist/utilities/isHtml.d.ts +2 -3
  65. package/dist/utilities/isHtml.d.ts.map +1 -1
  66. package/dist/utilities/isHtml.js +2 -3
  67. package/dist/utilities/removeCurrencySymbols.d.ts +2 -3
  68. package/dist/utilities/removeCurrencySymbols.d.ts.map +1 -1
  69. package/dist/utilities/removeCurrencySymbols.js +2 -3
  70. package/dist/utilities/removeNonNumeric.d.ts +2 -3
  71. package/dist/utilities/removeNonNumeric.d.ts.map +1 -1
  72. package/dist/utilities/removeNonNumeric.js +2 -3
  73. package/dist/utilities/stripHtmlTags.d.ts +2 -3
  74. package/dist/utilities/stripHtmlTags.d.ts.map +1 -1
  75. package/dist/utilities/stripHtmlTags.js +2 -3
  76. package/package.json +1 -1
@@ -2,12 +2,9 @@
2
2
  * Truncates a given text to a specified maximum length and appends an ellipsis ("...")
3
3
  * if the text exceeds the maximum length.
4
4
  *
5
- * @param {string} text - The input string to be truncated.
6
- *
7
- * @param {number} maxLength - The maximum allowed length of the string before truncation.
8
- *
9
- * @returns {string} The truncated string with an ellipsis if the input exceeds the maximum length,
10
- * or the original string if it does not.
5
+ * @param text - The input string to be truncated.
6
+ * @param maxLength - Maximum allowed length before truncation.
7
+ * @returns The truncated string with `"..."` appended, or the original string if it fits.
11
8
  * @example
12
9
  * ```typescript
13
10
  * const result = formatToEllipsis("Hello, world!", 5);
@@ -1 +1 @@
1
- {"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsBjE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsBjE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -2,12 +2,9 @@
2
2
  * Truncates a given text to a specified maximum length and appends an ellipsis ("...")
3
3
  * if the text exceeds the maximum length.
4
4
  *
5
- * @param {string} text - The input string to be truncated.
6
- *
7
- * @param {number} maxLength - The maximum allowed length of the string before truncation.
8
- *
9
- * @returns {string} The truncated string with an ellipsis if the input exceeds the maximum length,
10
- * or the original string if it does not.
5
+ * @param text - The input string to be truncated.
6
+ * @param maxLength - Maximum allowed length before truncation.
7
+ * @returns The truncated string with `"..."` appended, or the original string if it fits.
11
8
  * @example
12
9
  * ```typescript
13
10
  * const result = formatToEllipsis("Hello, world!", 5);
@@ -1,30 +1,19 @@
1
1
  /**
2
- * Formats a string by hiding specific digits within a given range.
2
+ * Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.
3
3
  *
4
- * This function takes a string input and replaces digits within a specified range
5
- * with a hiding character (e.g., "*"). Non-digit characters remain unchanged.
6
- *
7
- * @param {string} value - The input string to be formatted.
8
- * @param {FormatToHiddenDigitsOptions} options - Configuration options for formatting.
9
- * @param {number | [number, number]} options.range - The range of digits to hide. It can be:
10
- * - A single number (e.g., `3`), which hides the first `n` digits if positive,
11
- * or the last `n` digits if negative.
12
- * - A tuple `[start, end]` specifying the range of digits to hide (inclusive).
13
- * - Defaults to `3`, hiding the first three digits.
14
- * @param {string} options.hider - The character used to hide digits. Defaults to `"*"`.
15
- *
16
- * @returns {string} The formatted string with specified digits hidden.
17
- *
18
- * @example
19
- * ```typescript
20
- * const formatted = formatToHiddenDigits("123-456-7890", { range: 3 });
21
- * console.log(formatted); // Output: "***-456-7890"
22
- * ```
4
+ * @param value - The input string to mask.
5
+ * @param options.range - Which digits to hide:
6
+ * - Positive number `n` — hides the first `n` digits.
7
+ * - Negative number `-n` hides the last `n` digits.
8
+ * - Tuple `[start, end]` hides digits from position `start` to `end` (inclusive, 1-indexed).
9
+ * - Defaults to `3`.
10
+ * @param options.hider - The masking character. Defaults to `"*"`.
11
+ * @returns The string with the specified digit positions replaced.
23
12
  *
24
13
  * @example
25
14
  * ```typescript
26
- * const formatted = formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" });
27
- * console.log(formatted); // Output: "123-###-7890"
15
+ * formatToHiddenDigits("123-456-7890", { range: 3 }); // "***-456-7890"
16
+ * formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" }); // "123-###-7890"
28
17
  * ```
29
18
  */
30
19
  declare function formatToHiddenDigits(value: string, options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAS,oBAAoB,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D,MAAM,CAWR;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,oBAAoB,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D,MAAM,CAWR;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -19,32 +19,21 @@ const normalizeRange = (range, limit) => {
19
19
  };
20
20
  const within = (range, value) => value >= range[0] && value <= range[1];
21
21
  /**
22
- * Formats a string by hiding specific digits within a given range.
22
+ * Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.
23
23
  *
24
- * This function takes a string input and replaces digits within a specified range
25
- * with a hiding character (e.g., "*"). Non-digit characters remain unchanged.
26
- *
27
- * @param {string} value - The input string to be formatted.
28
- * @param {FormatToHiddenDigitsOptions} options - Configuration options for formatting.
29
- * @param {number | [number, number]} options.range - The range of digits to hide. It can be:
30
- * - A single number (e.g., `3`), which hides the first `n` digits if positive,
31
- * or the last `n` digits if negative.
32
- * - A tuple `[start, end]` specifying the range of digits to hide (inclusive).
33
- * - Defaults to `3`, hiding the first three digits.
34
- * @param {string} options.hider - The character used to hide digits. Defaults to `"*"`.
35
- *
36
- * @returns {string} The formatted string with specified digits hidden.
37
- *
38
- * @example
39
- * ```typescript
40
- * const formatted = formatToHiddenDigits("123-456-7890", { range: 3 });
41
- * console.log(formatted); // Output: "***-456-7890"
42
- * ```
24
+ * @param value - The input string to mask.
25
+ * @param options.range - Which digits to hide:
26
+ * - Positive number `n` — hides the first `n` digits.
27
+ * - Negative number `-n` hides the last `n` digits.
28
+ * - Tuple `[start, end]` hides digits from position `start` to `end` (inclusive, 1-indexed).
29
+ * - Defaults to `3`.
30
+ * @param options.hider - The masking character. Defaults to `"*"`.
31
+ * @returns The string with the specified digit positions replaced.
43
32
  *
44
33
  * @example
45
34
  * ```typescript
46
- * const formatted = formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" });
47
- * console.log(formatted); // Output: "123-###-7890"
35
+ * formatToHiddenDigits("123-456-7890", { range: 3 }); // "***-456-7890"
36
+ * formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" }); // "123-###-7890"
48
37
  * ```
49
38
  */
50
39
  function formatToHiddenDigits(value, options) {
@@ -5,9 +5,8 @@
5
5
  * national number, then applies the corresponding country's mask (underscore `_` used
6
6
  * as digit placeholder) replacing placeholders with actual digits.
7
7
  *
8
- * @param {string} phoneNumber - The input phone number (can include country code or be in national format).
9
- *
10
- * @returns {string} The phone number formatted following the country's mask.
8
+ * @param phoneNumber - The input phone number in E.164 format (e.g. `"+5534920524282"`).
9
+ * @returns The phone number formatted according to the country's mask.
11
10
  *
12
11
  * @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.
13
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iBAAS,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0BlD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iBAAS,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0BlD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -7,9 +7,8 @@ import { findCountryMask } from "../utilities/findCountryMask";
7
7
  * national number, then applies the corresponding country's mask (underscore `_` used
8
8
  * as digit placeholder) replacing placeholders with actual digits.
9
9
  *
10
- * @param {string} phoneNumber - The input phone number (can include country code or be in national format).
11
- *
12
- * @returns {string} The phone number formatted following the country's mask.
10
+ * @param phoneNumber - The input phone number in E.164 format (e.g. `"+5534920524282"`).
11
+ * @returns The phone number formatted according to the country's mask.
13
12
  *
14
13
  * @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.
15
14
  *
@@ -3,9 +3,8 @@
3
3
  * The function creates a hash from the string and uses it to calculate
4
4
  * RGB values, which are then converted to a hexadecimal color code.
5
5
  *
6
- * @param {string} rawString - The input string used to generate the color.
7
- *
8
- * @returns {string} A hexadecimal color code (e.g., "#a1b2c3") derived from the input string.
6
+ * @param rawString - The input string used to generate the color.
7
+ * @returns A hexadecimal color code (e.g., `"#a1b2c3"`) derived from the input string.
9
8
  *
10
9
  * @example
11
10
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,iBAAS,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -3,9 +3,8 @@
3
3
  * The function creates a hash from the string and uses it to calculate
4
4
  * RGB values, which are then converted to a hexadecimal color code.
5
5
  *
6
- * @param {string} rawString - The input string used to generate the color.
7
- *
8
- * @returns {string} A hexadecimal color code (e.g., "#a1b2c3") derived from the input string.
6
+ * @param rawString - The input string used to generate the color.
7
+ * @returns A hexadecimal color code (e.g., `"#a1b2c3"`) derived from the input string.
9
8
  *
10
9
  * @example
11
10
  * ```typescript
@@ -1,26 +1,15 @@
1
1
  /**
2
- * Generates a unique identifier (UUID) in the specified format and type.
2
+ * Generates a UUID in the specified version and output type.
3
3
  *
4
- * @param {"text" | "binary"} type - The desired output type of the UUID. Can be:
5
- * - `"text"`: Returns the UUID as a string.
6
- * - `"binary"`: Returns the UUID as a `Uint8Array` in binary format.
7
- * @param {"v4" | "v7"} format - The version of the UUID to generate. Can be:
8
- * - `"v4"`: Generates a random UUID (version 4).
9
- * - `"v7"`: Generates a time-ordered UUID (version 7).
10
- * @returns {string | Uint8Array} The generated UUID in the specified type and format.
11
- * - If `type` is `"text"`, a string representation of the UUID is returned.
12
- * - If `type` is `"binary"`, a `Uint8Array` representation of the UUID is returned.
13
- * @throws {Error} If an invalid `type` or `format` is provided.
4
+ * @param type - Output representation: `"text"` (string) or `"binary"` (`Uint8Array`).
5
+ * @param format - UUID version: `"v4"` (random) or `"v7"` (time-ordered).
6
+ * @returns The UUID as a string or `Uint8Array` depending on `type`.
14
7
  *
15
8
  * @example
16
- * // Generate a version 4 UUID as a string
17
- * const idTextV4 = generateId("text", "v4");
18
- * console.log(idTextV4); // e.g., "550e8400-e29b-41d4-a716-446655440000"
19
- *
20
- * @example
21
- * // Generate a version 7 UUID as binary
22
- * const idBinaryV7 = generateId("binary", "v7");
23
- * console.log(idBinaryV7); // Uint8Array([...])
9
+ * ```typescript
10
+ * generateId("text", "v4"); // "550e8400-e29b-41d4-a716-446655440000"
11
+ * generateId("binary", "v7"); // Uint8Array([...])
12
+ * ```
24
13
  */
25
14
  declare function generateId(type: "text", format: "v4" | "v7"): string;
26
15
  declare function generateId(type: "binary", format: "v4" | "v7"): Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/generators/generateId.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC/D,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,CAAC;AAYrE,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/generators/generateId.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC/D,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,CAAC;AAYrE,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -9,9 +9,8 @@
9
9
  * - Collapses multiple consecutive hyphens into a single hyphen.
10
10
  * - Trims leading and trailing hyphens.
11
11
  *
12
- * @param {string} rawString - The input string to be converted into a slug.
13
- *
14
- * @returns {string} A URL-friendly slug derived from the input string.
12
+ * @param rawString - The input string to be converted into a slug.
13
+ * @returns A URL-friendly slug derived from the input string.
15
14
  *
16
15
  * @example
17
16
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"generateSlug.d.ts","sourceRoot":"","sources":["../../src/generators/generateSlug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,iBAAS,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAa/C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"generateSlug.d.ts","sourceRoot":"","sources":["../../src/generators/generateSlug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iBAAS,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAa/C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -9,9 +9,8 @@
9
9
  * - Collapses multiple consecutive hyphens into a single hyphen.
10
10
  * - Trims leading and trailing hyphens.
11
11
  *
12
- * @param {string} rawString - The input string to be converted into a slug.
13
- *
14
- * @returns {string} A URL-friendly slug derived from the input string.
12
+ * @param rawString - The input string to be converted into a slug.
13
+ * @returns A URL-friendly slug derived from the input string.
15
14
  *
16
15
  * @example
17
16
  * ```typescript
@@ -5,10 +5,9 @@
5
5
  * any string fields that exceed the specified maximum length. If a string field is truncated,
6
6
  * it is replaced with a message indicating the original length of the field.
7
7
  *
8
- * @param {string} jsonString - The JSON string to process.
9
- * @param {number} maxLength - The maximum allowed length for string fields. Defaults to 1000.
10
- *
11
- * @returns {string} A JSON string with large string fields truncated.
8
+ * @param jsonString - The JSON string to process.
9
+ * @param maxLength - The maximum allowed length for string fields. Defaults to 1000.
10
+ * @returns A JSON string with large string fields truncated.
12
11
  *
13
12
  * @throws {Error} Throws an error if the input is not a valid JSON string.
14
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"parseLargeFields.d.ts","sourceRoot":"","sources":["../../src/parsers/parseLargeFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,iBAAS,gBAAgB,CACvB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAa,GACvB,MAAM,CA6BR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"parseLargeFields.d.ts","sourceRoot":"","sources":["../../src/parsers/parseLargeFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iBAAS,gBAAgB,CACvB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAa,GACvB,MAAM,CA6BR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -5,10 +5,9 @@
5
5
  * any string fields that exceed the specified maximum length. If a string field is truncated,
6
6
  * it is replaced with a message indicating the original length of the field.
7
7
  *
8
- * @param {string} jsonString - The JSON string to process.
9
- * @param {number} maxLength - The maximum allowed length for string fields. Defaults to 1000.
10
- *
11
- * @returns {string} A JSON string with large string fields truncated.
8
+ * @param jsonString - The JSON string to process.
9
+ * @param maxLength - The maximum allowed length for string fields. Defaults to 1000.
10
+ * @returns A JSON string with large string fields truncated.
12
11
  *
13
12
  * @throws {Error} Throws an error if the input is not a valid JSON string.
14
13
  *
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Masks sensitive data in a JSON string by replacing the values of specified keys with "****".
3
3
  *
4
- * @param {string} jsonString - The JSON string to be processed.
5
- * @param {string[]} sensitiveKeys - An array of keys whose values should be masked. Defaults to `["password", "confirmPassword", "creditCard"]`.
6
- *
7
- * @returns {string} A JSON string with sensitive data masked. If the input is not a valid JSON string, it returns the original string.
4
+ * @param jsonString - The JSON string to be processed.
5
+ * @param sensitiveKeys - Keys whose values will be replaced with `"****"`. Defaults to `["password", "confirmPassword", "creditCard"]`.
6
+ * @returns A JSON string with sensitive values masked. Returns the original string if it is not valid JSON.
8
7
  *
9
8
  * @example
10
9
  * ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"parseSensitiveData.d.ts","sourceRoot":"","sources":["../../src/parsers/parseSensitiveData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,GAAE,MAAM,EAAkD,GACtE,MAAM,CAkCR;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"parseSensitiveData.d.ts","sourceRoot":"","sources":["../../src/parsers/parseSensitiveData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,GAAE,MAAM,EAAkD,GACtE,MAAM,CAkCR;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Masks sensitive data in a JSON string by replacing the values of specified keys with "****".
3
3
  *
4
- * @param {string} jsonString - The JSON string to be processed.
5
- * @param {string[]} sensitiveKeys - An array of keys whose values should be masked. Defaults to `["password", "confirmPassword", "creditCard"]`.
6
- *
7
- * @returns {string} A JSON string with sensitive data masked. If the input is not a valid JSON string, it returns the original string.
4
+ * @param jsonString - The JSON string to be processed.
5
+ * @param sensitiveKeys - Keys whose values will be replaced with `"****"`. Defaults to `["password", "confirmPassword", "creditCard"]`.
6
+ * @returns A JSON string with sensitive values masked. Returns the original string if it is not valid JSON.
8
7
  *
9
8
  * @example
10
9
  * ```typescript
@@ -1,39 +1,23 @@
1
1
  /**
2
- * Converts a date and time input into a JavaScript `Date` object, formatted according to the specified input format and timezone.
2
+ * Parses a date (and optional time) string into a JavaScript `Date` object.
3
+ * All calculations are in UTC+0; use `timezone` to shift the result.
3
4
  *
4
- * @remarks
5
- * **Note:** This function works with UTC+0 by default. The returned Date object is not automatically converted to the machine's local timezone.
6
- * To adjust the timezone, you must manually specify the `timezone` parameter (e.g., -3 for UTC-3).
5
+ * @param date - Date string in the format determined by `inputFormat`.
6
+ * @param time - Optional time string `"HH:mm:ss"` (defaults to `"00:00:00"`).
7
+ * @param inputFormat - Parsing format:
8
+ * - `"brazilianDate"`: DD/MM/YYYY
9
+ * - `"isoDate"`: MM-DD-YYYY
10
+ * - `"timestamp"`: YYYY-MM-DD
11
+ * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
12
+ * @returns A `Date` object representing the parsed date and time.
7
13
  *
8
- * @param {string[]} dateTime - An array containing the date and optional time.
9
- * - The first element is the date string.
10
- * - The second element is the time string (default is "00:00:00")
11
- * @param {"brazilianDate" | "isoDate" | "timestamp"} inputFormat - The format of the input date.
12
- * - "brazilianDate": Expects the date in "DD/MM/YYYY" or "D/M/YYYY" format.
13
- * - "isoDate": Expects the date in "MM-DD-YYYY" or "M-D-YYYY" format.
14
- * - "timestamp": Expects the date in "YYYY-MM-DD" or "YYYY-M-D" format.
15
- * @param {number} [timezone=0] - The timezone offset in hours to apply to the date.
16
- * - Defaults to 0 (UTC).
17
- *
18
- * @returns {Date} A `Date` object representing the parsed date and time, adjusted for the specified timezone.
19
- *
20
- * @throws {Error} If the `inputFormat` is invalid.
21
- * @throws {Error} If the provided date or time is invalid.
22
- *
23
- * @example Format a Brazilian date to Date
24
- * ```typescript
25
- * const date = parseToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
26
- * console.log(date); // Outputs a Date object for "2023-12-25T12:30:00.000Z" (UTC)
27
- * ```
28
- * @example Format an ISO date to Date
29
- * ```typescript
30
- * const date = parseToDate(["12-25-2023", "15:30:00"], "isoDate", 2);
31
- * console.log(date); // Outputs a Date object for "2023-12-25T13:30:00.000Z" (UTC)
32
- * ```
33
- * @example Format a timestamp date to Date
14
+ * @example
34
15
  * ```typescript
35
- * const date = parseToDate(["2023-12-25", "15:30:00"], "timestamp");
36
- * console.log(date); // Outputs a Date object for "2023-12-25T15:30:00.000Z" (UTC)
16
+ * parseToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
17
+ * // Date: 2023-12-25T12:30:00.000Z
18
+ *
19
+ * parseToDate(["2023-12-25"], "timestamp");
20
+ * // Date: 2023-12-25T00:00:00.000Z
37
21
  * ```
38
22
  */
39
23
  declare function parseToDate([date, time]: string[], inputFormat: "brazilianDate" | "isoDate" | "timestamp", timezone?: number): Date;
@@ -1 +1 @@
1
- {"version":3,"file":"parseToDate.d.ts","sourceRoot":"","sources":["../../src/parsers/parseToDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAS,WAAW,CAClB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,EACtD,QAAQ,GAAE,MAAU,GACnB,IAAI,CAkCN;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"parseToDate.d.ts","sourceRoot":"","sources":["../../src/parsers/parseToDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iBAAS,WAAW,CAClB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,EACtD,QAAQ,GAAE,MAAU,GACnB,IAAI,CAkCN;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,40 +1,24 @@
1
1
  import { ValidateDateService } from "../services/validateDateService";
2
2
  /**
3
- * Converts a date and time input into a JavaScript `Date` object, formatted according to the specified input format and timezone.
3
+ * Parses a date (and optional time) string into a JavaScript `Date` object.
4
+ * All calculations are in UTC+0; use `timezone` to shift the result.
4
5
  *
5
- * @remarks
6
- * **Note:** This function works with UTC+0 by default. The returned Date object is not automatically converted to the machine's local timezone.
7
- * To adjust the timezone, you must manually specify the `timezone` parameter (e.g., -3 for UTC-3).
6
+ * @param date - Date string in the format determined by `inputFormat`.
7
+ * @param time - Optional time string `"HH:mm:ss"` (defaults to `"00:00:00"`).
8
+ * @param inputFormat - Parsing format:
9
+ * - `"brazilianDate"`: DD/MM/YYYY
10
+ * - `"isoDate"`: MM-DD-YYYY
11
+ * - `"timestamp"`: YYYY-MM-DD
12
+ * @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
13
+ * @returns A `Date` object representing the parsed date and time.
8
14
  *
9
- * @param {string[]} dateTime - An array containing the date and optional time.
10
- * - The first element is the date string.
11
- * - The second element is the time string (default is "00:00:00")
12
- * @param {"brazilianDate" | "isoDate" | "timestamp"} inputFormat - The format of the input date.
13
- * - "brazilianDate": Expects the date in "DD/MM/YYYY" or "D/M/YYYY" format.
14
- * - "isoDate": Expects the date in "MM-DD-YYYY" or "M-D-YYYY" format.
15
- * - "timestamp": Expects the date in "YYYY-MM-DD" or "YYYY-M-D" format.
16
- * @param {number} [timezone=0] - The timezone offset in hours to apply to the date.
17
- * - Defaults to 0 (UTC).
18
- *
19
- * @returns {Date} A `Date` object representing the parsed date and time, adjusted for the specified timezone.
20
- *
21
- * @throws {Error} If the `inputFormat` is invalid.
22
- * @throws {Error} If the provided date or time is invalid.
23
- *
24
- * @example Format a Brazilian date to Date
25
- * ```typescript
26
- * const date = parseToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
27
- * console.log(date); // Outputs a Date object for "2023-12-25T12:30:00.000Z" (UTC)
28
- * ```
29
- * @example Format an ISO date to Date
30
- * ```typescript
31
- * const date = parseToDate(["12-25-2023", "15:30:00"], "isoDate", 2);
32
- * console.log(date); // Outputs a Date object for "2023-12-25T13:30:00.000Z" (UTC)
33
- * ```
34
- * @example Format a timestamp date to Date
15
+ * @example
35
16
  * ```typescript
36
- * const date = parseToDate(["2023-12-25", "15:30:00"], "timestamp");
37
- * console.log(date); // Outputs a Date object for "2023-12-25T15:30:00.000Z" (UTC)
17
+ * parseToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
18
+ * // Date: 2023-12-25T12:30:00.000Z
19
+ *
20
+ * parseToDate(["2023-12-25"], "timestamp");
21
+ * // Date: 2023-12-25T00:00:00.000Z
38
22
  * ```
39
23
  */
40
24
  function parseToDate([date, time = "00:00:00"], inputFormat, timezone = 0) {
@@ -1,35 +1,14 @@
1
1
  /**
2
- * Service for validating date components and input formats.
2
+ * Validates date components and input format strings for date-parsing utilities.
3
+ * Enforces 4-digit years, month/day ranges, month-specific day counts, and leap year rules.
3
4
  *
4
- * This service provides methods to validate date parts (year, month, day) and
5
- * input format strings used in date parsing operations. It includes leap year
6
- * validation and month-specific day validation.
7
- *
8
- * @remarks
9
- * The service validates:
10
- * - Year must be exactly 4 digits (1000-9999)
11
- * - Month must be between 1 and 12
12
- * - Day must be between 1 and 31
13
- * - Day must be valid for the specific month (e.g., no February 30)
14
- * - Leap year rules for February 29
15
- *
16
- * @example Validate a valid date
17
- * ```typescript
18
- * const service = new ValidateDateService();
19
- * service.validateDateParts(2024, 1, 15); // No error thrown
20
- * ```
21
- *
22
- * @example Validate an invalid date
5
+ * @example
23
6
  * ```typescript
24
7
  * const service = new ValidateDateService();
25
- * service.validateDateParts(2023, 2, 29); // Throws: "Day 29 is not valid for February 2023 (non-leap year)"
26
- * ```
27
- *
28
- * @example Validate input format
29
- * ```typescript
30
- * const service = new ValidateDateService();
31
- * service.validateInputFormat("brazilianDate"); // No error thrown
32
- * service.validateInputFormat("invalidFormat"); // Throws: "Invalid input format: invalidFormat"
8
+ * service.validateDateParts(2024, 2, 29); // OK leap year
9
+ * service.validateDateParts(2023, 2, 29); // throws — not a leap year
10
+ * service.validateInputFormat("brazilianDate"); // OK
11
+ * service.validateInputFormat("custom"); // throws
33
12
  * ```
34
13
  */
35
14
  declare class ValidateDateService {
@@ -37,47 +16,17 @@ declare class ValidateDateService {
37
16
  private getDaysInMonth;
38
17
  private validateDayInMonth;
39
18
  /**
40
- * Validates the components of a date (year, month, and day).
41
- *
42
- * @param {number} year - The year to validate (must be 4 digits).
43
- * @param {number} month - The month to validate (must be between 1 and 12).
44
- * @param {number} day - The day to validate (must be between 1 and 31, and valid for the month).
45
- *
46
- * @throws {Error} "Year should be four digits" - If the year doesn't have exactly 4 digits.
47
- * @throws {Error} "Month should be between 1 and 12" - If the month is out of valid range.
48
- * @throws {Error} "Day should be between 1 and 31" - If the day is out of valid range.
49
- * @throws {Error} Month-specific error - If the day is invalid for the specific month.
19
+ * Throws if year, month, or day are out of valid range or inconsistent with the calendar.
50
20
  *
51
- * @example
52
- * ```typescript
53
- * const service = new ValidateDateService();
54
- * service.validateDateParts(2024, 2, 29); // Valid leap year date
55
- * service.validateDateParts(2023, 2, 29); // Throws error - not a leap year
56
- * service.validateDateParts(2024, 4, 31); // Throws error - April has only 30 days
57
- * ```
21
+ * @param year - 4-digit year (1000–9999).
22
+ * @param month - Month number (1–12).
23
+ * @param day - Day number (1–31, validated against the specific month).
58
24
  */
59
25
  validateDateParts(year: number, month: number, day: number): void;
60
26
  /**
61
- * Validates that a given format string is supported.
62
- *
63
- * @param {string} format - The format string to validate.
64
- *
65
- * @throws {Error} "Invalid input format: {format}" - If the format is not one of the valid formats.
66
- *
67
- * @remarks
68
- * Valid formats are:
69
- * - "brazilianDate": DD/MM/YYYY format
70
- * - "isoDate": MM-DD-YYYY format
71
- * - "timestamp": YYYY-MM-DD format
27
+ * Throws if `format` is not one of `"brazilianDate"`, `"isoDate"`, or `"timestamp"`.
72
28
  *
73
- * @example
74
- * ```typescript
75
- * const service = new ValidateDateService();
76
- * service.validateInputFormat("brazilianDate"); // Valid
77
- * service.validateInputFormat("isoDate"); // Valid
78
- * service.validateInputFormat("timestamp"); // Valid
79
- * service.validateInputFormat("customFormat"); // Throws error
80
- * ```
29
+ * @param format - The format string to check.
81
30
  */
82
31
  validateInputFormat(format: string): void;
83
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validateDateService.d.ts","sourceRoot":"","sources":["../../src/services/validateDateService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,cAAM,mBAAmB;IACvB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,kBAAkB;IA2B1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAcjE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAM1C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"validateDateService.d.ts","sourceRoot":"","sources":["../../src/services/validateDateService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAM,mBAAmB;IACvB,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;CAM1C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}