@arkyn/shared 2.0.1-beta.14 → 2.0.1-beta.16

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