@arkyn/shared 2.0.1-beta.13 → 2.0.1-beta.15

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 (2) hide show
  1. package/README.md +113 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ The `@arkyn/shared` package provides reusable utilities such as formatting functions, generators, services, and validations. It is designed to be used across different parts of a project, offering common and practical solutions to streamline development.
2
+
3
+ ---
4
+
5
+ ## 📦 Installation
6
+
7
+ Install the package using npm:
8
+
9
+ ```bash
10
+ npm install @arkyn/shared
11
+ ```
12
+
13
+ ---
14
+
15
+ ## ✨ Features
16
+
17
+ ### 📅 Formatting
18
+
19
+ - **`formatDate(date: Date): string`**
20
+ Formats a date into a readable string.
21
+
22
+ - **`formatJsonObject(obj: object): string`**
23
+ Converts a JSON object into a formatted string.
24
+
25
+ - **`formatJsonString(json: string): object`**
26
+ Converts a JSON string into an object.
27
+
28
+ - **`formatToCep(value: string): string`**
29
+ Formats a string into the CEP format (`XXXXX-XXX`).
30
+
31
+ - **`formatToCnpj(value: string): string`**
32
+ Formats a string into the CNPJ format (`XX.XXX.XXX/XXXX-XX`).
33
+
34
+ - **`formatToCpf(value: string): string`**
35
+ Formats a string into the CPF format (`XXX.XXX.XXX-XX`).
36
+
37
+ - **`formatToCpfCnpj(value: string): string`**
38
+ Formats a string into either CPF or CNPJ format, depending on its length.
39
+
40
+ - **`formatToCurrency(value: number): string`**
41
+ Converts a number into a currency format.
42
+
43
+ - **`formatToEllipsis(value: string, maxLength: number): string`**
44
+ Truncates a string and appends an ellipsis if it exceeds the maximum length.
45
+
46
+ - **`formatToHiddenDigits(value: string): string`**
47
+ Masks part of a string by replacing it with asterisks.
48
+
49
+ - **`formatToPhone(value: string): string`**
50
+ Formats a string into a phone number format.
51
+
52
+ ---
53
+
54
+ ### ⚙️ Generators
55
+
56
+ - **`generateColorByString(value: string): string`**
57
+ Generates a hexadecimal color based on a string.
58
+
59
+ - **`generateId(): string`**
60
+ Generates a unique identifier.
61
+
62
+ - **`generateSlug(value: string): string`**
63
+ Converts a string into a URL-friendly slug.
64
+
65
+ ---
66
+
67
+ ### 🛠️ Services
68
+
69
+ - **`calculateCardInstallment(total: number, installments: number): number[]`**
70
+ Calculates the installment values for a given total.
71
+
72
+ - **`maskSensitiveData(data: string): string`**
73
+ Masks sensitive data in a string.
74
+
75
+ - **`removeNonNumeric(value: string): string`**
76
+ Removes all non-numeric characters from a string.
77
+
78
+ - **`truncateLargeFields(obj: object, maxLength: number): object`**
79
+ Truncates large fields in an object to a specified maximum length.
80
+
81
+ ---
82
+
83
+ ### ✅ Validations
84
+
85
+ - **`validateCep(value: string): boolean`**
86
+ Validates whether a string is a valid CEP.
87
+
88
+ - **`validateCnpj(value: string): boolean`**
89
+ Validates whether a string is a valid CNPJ.
90
+
91
+ - **`validateCpf(value: string): boolean`**
92
+ Validates whether a string is a valid CPF.
93
+
94
+ - **`validateDate(value: string): boolean`**
95
+ Validates whether a string is a valid date.
96
+
97
+ - **`validatePhone(value: string): boolean`**
98
+ Validates whether a string is a valid phone number.
99
+
100
+ - **`validateRg(value: string): boolean`**
101
+ Validates whether a string is a valid ID (RG).
102
+
103
+ ---
104
+
105
+ ## 🤝 Contribution
106
+
107
+ Contributions are welcome! Feel free to open issues or submit pull requests to improve the project.
108
+
109
+ ---
110
+
111
+ ## 📄 License
112
+
113
+ This project is licensed under the MIT License. See the `LICENSE` file for more details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/shared",
3
- "version": "2.0.1-beta.13",
3
+ "version": "2.0.1-beta.15",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./src/index.ts",
6
6
  "type": "module",