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