@sankhyalabs/core-docs 2.3.6 → 2.4.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.
@@ -2,12 +2,7 @@
2
2
 
3
3
  # Class: NumberUtils
4
4
 
5
- `NumberUtils` é uma biblioteca para manipulação de números
6
-
7
- `Métodos`:
8
-
9
- @stringToNumber: converte um número em formato de string em um valor numérico nativo do javascript
10
- @format: arredonda um número em formato de string baseado nos parâmetros "presision" e "prettyPrecision";
5
+ `NumberUtils`: Utilizado para manipulação de numerais.
11
6
 
12
7
  ## Table of contents
13
8
 
@@ -36,23 +31,35 @@
36
31
 
37
32
  ▸ `Static` **changeFormat**(`value`): `string`
38
33
 
39
- @changeFormat: troca o formato do numero string de "PT-BR" para "EN-US" e vice-versa
34
+ Troca o formato do numeral(string) de "PT-BR" para "EN-US" e vice-versa.
35
+
36
+ **`Example`**
37
+
38
+ ```ts
39
+ Informo: "15,55" | Obtenho: "15.55"
40
+ ```
41
+
42
+ **`Example`**
43
+
44
+ ```ts
45
+ Informo: "27.99" | Obtenho: "27,99"
46
+ ```
40
47
 
41
48
  #### Parameters
42
49
 
43
50
  | Name | Type | Description |
44
51
  | :------ | :------ | :------ |
45
- | `value` | `string` | numero em formato de string a ser convertido |
52
+ | `value` | `string` | Numeral em formato de string a ser convertido. |
46
53
 
47
54
  #### Returns
48
55
 
49
56
  `string`
50
57
 
51
- numero em formato de string formatado de "PT-BR" para "EN-US" e vice-versa
58
+ - Numeral em formato de string formatado de "PT-BR" para "EN-US" e vice-versa.
52
59
 
53
60
  #### Defined in
54
61
 
55
- src/utils/NumberUtils.ts:171
62
+ src/utils/NumberUtils.ts:168
56
63
 
57
64
  ___
58
65
 
@@ -60,25 +67,31 @@ ___
60
67
 
61
68
  ▸ `Static` **format**(`value`, `precision`, `prettyPrecision?`): `string`
62
69
 
63
- @format: converte um numero em formato de string em um numero em formato de string formatado de acordo com os parametros de "precision" e "prettyPrecision"
70
+ Formata o numeral com a precisão informada.
71
+
72
+ **`Example`**
73
+
74
+ ```ts
75
+ Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
76
+ ```
64
77
 
65
78
  #### Parameters
66
79
 
67
80
  | Name | Type | Default value | Description |
68
81
  | :------ | :------ | :------ | :------ |
69
- | `value` | `string` | `undefined` | numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico - sem separador de milhares: ######.##) |
70
- | `precision` | `number` | `undefined` | (numero de decimais) |
71
- | `prettyPrecision` | `number` | `NaN` | (numero de zeros nos decimais) |
82
+ | `value` | `string` | `undefined` | Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico - sem separador de milhares: ######.##). |
83
+ | `precision` | `number` | `undefined` | Quantidade de casas decimais. |
84
+ | `prettyPrecision` | `number` | `NaN` | Quantidade de zeros nos decimais. |
72
85
 
73
86
  #### Returns
74
87
 
75
88
  `string`
76
89
 
77
- numero em formato de string formatado em PT-BR
90
+ - Numeral em formato de String formatado em PT-BR.
78
91
 
79
92
  #### Defined in
80
93
 
81
- src/utils/NumberUtils.ts:83
94
+ src/utils/NumberUtils.ts:74
82
95
 
83
96
  ___
84
97
 
@@ -86,24 +99,42 @@ ___
86
99
 
87
100
  ▸ `Static` **getValueOrDefault**(`value`, `defaultValue`): `number`
88
101
 
89
- @getValueOrDefault: retorna o valor passado como number, caso NaN retorna o defaultValue
102
+ Obtém o valor ou o valor padrão, caso o valor seja inválido(NaN/undefined).
103
+
104
+ **`Example`**
105
+
106
+ ```ts
107
+ Informo: value: 30, defaultValue: 0 | Obtenho: 30
108
+ ```
109
+
110
+ **`Example`**
111
+
112
+ ```ts
113
+ Informo: value: "30", defaultValue: 0 | Obtenho: 30
114
+ ```
115
+
116
+ **`Example`**
117
+
118
+ ```ts
119
+ Informo: value: "30abc", defaultValue: 0 | Obtenho: 0
120
+ ```
90
121
 
91
122
  #### Parameters
92
123
 
93
124
  | Name | Type | Description |
94
125
  | :------ | :------ | :------ |
95
- | `value` | `any` | numero a ser validado |
96
- | `defaultValue` | `number` | numero a ser retornado caso o value seja inválido |
126
+ | `value` | `any` | Valor a ser validado. |
127
+ | `defaultValue` | `number` | Valor padrão a ser retornado caso o value seja inválido. |
97
128
 
98
129
  #### Returns
99
130
 
100
131
  `number`
101
132
 
102
- o proprio numero passado ou zero
133
+ - O próprio numeral passado ou zero.
103
134
 
104
135
  #### Defined in
105
136
 
106
- src/utils/NumberUtils.ts:186
137
+ src/utils/NumberUtils.ts:190
107
138
 
108
139
  ___
109
140
 
@@ -111,23 +142,23 @@ ___
111
142
 
112
143
  ▸ `Static` **getValueOrZero**(`value`): `number`
113
144
 
114
- @getValueOrZero: valida se o parametro é undefined caso seja retorna zero.
145
+ Obtém o valor ou zero, caso o valor seja inválido(NaN/undefined).
115
146
 
116
147
  #### Parameters
117
148
 
118
149
  | Name | Type | Description |
119
150
  | :------ | :------ | :------ |
120
- | `value` | `any` | numero a ser validado |
151
+ | `value` | `any` | Numeral a ser validado. |
121
152
 
122
153
  #### Returns
123
154
 
124
155
  `number`
125
156
 
126
- o proprio numero passado ou zero
157
+ - O próprio numeral passado. Caso esse seja inválido retorna zero.
127
158
 
128
159
  #### Defined in
129
160
 
130
- src/utils/NumberUtils.ts:205
161
+ src/utils/NumberUtils.ts:209
131
162
 
132
163
  ___
133
164
 
@@ -135,24 +166,30 @@ ___
135
166
 
136
167
  ▸ `Static` **keepOnlyDecimalSeparator**(`value`, `formatnumber?`): `string`
137
168
 
138
- @keepOnlyDecimalSeparator: retira os separadores de milhar de um número em formato de string
169
+ Retira os separadores de milhar de um numeral em formato de string.
170
+
171
+ **`Example`**
172
+
173
+ ```ts
174
+ Informado: '95.12' | Retorna: '9512'
175
+ ```
139
176
 
140
177
  #### Parameters
141
178
 
142
179
  | Name | Type | Default value | Description |
143
180
  | :------ | :------ | :------ | :------ |
144
- | `value` | `string` | `undefined` | numero em formato de string a ser convertido |
145
- | `formatnumber` | `string` | `'pt-BR'` | (formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR") |
181
+ | `value` | `string` | `undefined` | Numeral em formato de string a ser convertido. |
182
+ | `formatnumber` | `string` | `'pt-BR'` | Formatação de ENTRADA e SAÍDA do utilitário: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR". |
146
183
 
147
184
  #### Returns
148
185
 
149
186
  `string`
150
187
 
151
- numero em formato de string formatado apenas com separador decimal
188
+ - Numeral em formato de string formatado apenas com separador decimal.
152
189
 
153
190
  #### Defined in
154
191
 
155
- src/utils/NumberUtils.ts:147
192
+ src/utils/NumberUtils.ts:140
156
193
 
157
194
  ___
158
195
 
@@ -160,29 +197,31 @@ ___
160
197
 
161
198
  ▸ `Static` **stringToNumber**(`value`): `number`
162
199
 
163
- @stringToNumber: converte um numero em formato de string em numero
200
+ Converte o dado numérico de string para number.
164
201
 
165
- **`Exemples`**
202
+ **`Example`**
166
203
 
204
+ ```ts
167
205
  @"100,12" | 100.12
168
206
  @"100.12" | 100.12
169
207
  @"-100,12" | -100.12
170
208
  @"R$100,12" | 100.12
171
209
  @"-R$100,12" | -100.12
172
210
  @"string" | NaN
211
+ ```
173
212
 
174
213
  #### Parameters
175
214
 
176
215
  | Name | Type | Description |
177
216
  | :------ | :------ | :------ |
178
- | `value` | `string` | numero em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##) |
217
+ | `value` | `string` | Numeral em formato de string a ser convertido (Importante: formato PT-BR ou já em formato numérico: ######.##). |
179
218
 
180
219
  #### Returns
181
220
 
182
221
  `number`
183
222
 
184
- string based number
223
+ - Numeral passado.
185
224
 
186
225
  #### Defined in
187
226
 
188
- src/utils/NumberUtils.ts:33
227
+ src/utils/NumberUtils.ts:22
@@ -2,6 +2,8 @@
2
2
 
3
3
  # Class: ObjectUtils
4
4
 
5
+ `ObjectUtils`: Utilizado para manipulação de objetos.
6
+
5
7
  ## Table of contents
6
8
 
7
9
  ### Constructors
@@ -26,19 +28,23 @@
26
28
 
27
29
  ▸ `Static` **copy**(`data`): ``null`` \| `Object` \| `Object`[]
28
30
 
31
+ Faz a cópia do objeto.
32
+
29
33
  #### Parameters
30
34
 
31
- | Name | Type |
32
- | :------ | :------ |
33
- | `data` | `Object` \| `Object`[] |
35
+ | Name | Type | Description |
36
+ | :------ | :------ | :------ |
37
+ | `data` | `Object` \| `Object`[] | Objeto a ser copiado. |
34
38
 
35
39
  #### Returns
36
40
 
37
41
  ``null`` \| `Object` \| `Object`[]
38
42
 
43
+ - A cópia do objeto válido.
44
+
39
45
  #### Defined in
40
46
 
41
- src/utils/ObjectUtils.ts:3
47
+ src/utils/ObjectUtils.ts:13
42
48
 
43
49
  ___
44
50
 
@@ -46,19 +52,27 @@ ___
46
52
 
47
53
  ▸ `Static` **objectToString**(`data`): `string`
48
54
 
55
+ Converte um objeto em string/JSON.
56
+
57
+ **`Example`**
58
+
59
+ @Informado: ```{nome : "Sankhya", cidade: "Uberlandia"}``` | Obtenho: ```"{"nome" : "Sankhya", "cidade":"Uberlandia"}"```
60
+
49
61
  #### Parameters
50
62
 
51
- | Name | Type |
52
- | :------ | :------ |
53
- | `data` | `Object` \| `Object`[] |
63
+ | Name | Type | Description |
64
+ | :------ | :------ | :------ |
65
+ | `data` | `Object` \| `Object`[] | Objeto a ser convertido. |
54
66
 
55
67
  #### Returns
56
68
 
57
69
  `string`
58
70
 
71
+ - Uma string JSON.
72
+
59
73
  #### Defined in
60
74
 
61
- src/utils/ObjectUtils.ts:7
75
+ src/utils/ObjectUtils.ts:26
62
76
 
63
77
  ___
64
78
 
@@ -66,16 +80,24 @@ ___
66
80
 
67
81
  ▸ `Static` **stringToObject**(`data`): `Object` \| `Object`[]
68
82
 
83
+ Converte uma string/JSON em objeto.
84
+
85
+ **`Example`**
86
+
87
+ Informado: ```"{"nome" : "Sankhya", "cidade":"Uberlandia"}"``` | Obtenho: ```{nome : "Sankhya", cidade: "Uberlandia"}```
88
+
69
89
  #### Parameters
70
90
 
71
- | Name | Type |
72
- | :------ | :------ |
73
- | `data` | `string` |
91
+ | Name | Type | Description |
92
+ | :------ | :------ | :------ |
93
+ | `data` | `string` | String a ser convertida. |
74
94
 
75
95
  #### Returns
76
96
 
77
97
  `Object` \| `Object`[]
78
98
 
99
+ - Um objeto válido.
100
+
79
101
  #### Defined in
80
102
 
81
- src/utils/ObjectUtils.ts:11
103
+ src/utils/ObjectUtils.ts:39
@@ -2,6 +2,8 @@
2
2
 
3
3
  # Class: ReadyUtil
4
4
 
5
+ `ReadyUtil`: Registra processos que serão invocados após a conclusão de operações.
6
+
5
7
  ## Table of contents
6
8
 
7
9
  ### Constructors
@@ -34,7 +36,7 @@
34
36
 
35
37
  #### Defined in
36
38
 
37
- src/utils/ReadyUtil.ts:3
39
+ src/utils/ReadyUtil.ts:6
38
40
 
39
41
  ___
40
42
 
@@ -44,7 +46,7 @@ ___
44
46
 
45
47
  #### Defined in
46
48
 
47
- src/utils/ReadyUtil.ts:2
49
+ src/utils/ReadyUtil.ts:5
48
50
 
49
51
  ## Methods
50
52
 
@@ -52,13 +54,15 @@ src/utils/ReadyUtil.ts:2
52
54
 
53
55
  ▸ `Private` **clean**(): `void`
54
56
 
57
+ Limpa o estado da instancia ao finalizar a execução do processo registrado.
58
+
55
59
  #### Returns
56
60
 
57
61
  `void`
58
62
 
59
63
  #### Defined in
60
64
 
61
- src/utils/ReadyUtil.ts:5
65
+ src/utils/ReadyUtil.ts:11
62
66
 
63
67
  ___
64
68
 
@@ -66,13 +70,15 @@ ___
66
70
 
67
71
  ▸ **end**(): `void`
68
72
 
73
+ Executa processo atribuído.
74
+
69
75
  #### Returns
70
76
 
71
77
  `void`
72
78
 
73
79
  #### Defined in
74
80
 
75
- src/utils/ReadyUtil.ts:16
81
+ src/utils/ReadyUtil.ts:28
76
82
 
77
83
  ___
78
84
 
@@ -80,13 +86,15 @@ ___
80
86
 
81
87
  ▸ `Private` **start**(): `void`
82
88
 
89
+ Inicializa o estado da instancia ao registrar processo.
90
+
83
91
  #### Returns
84
92
 
85
93
  `void`
86
94
 
87
95
  #### Defined in
88
96
 
89
- src/utils/ReadyUtil.ts:10
97
+ src/utils/ReadyUtil.ts:19
90
98
 
91
99
  ___
92
100
 
@@ -94,10 +102,14 @@ ___
94
102
 
95
103
  ▸ **whenReady**(): `Promise`<`unknown`\>
96
104
 
105
+ Atribui processo que será executado por operações que o invocarem no método 'end'.
106
+
97
107
  #### Returns
98
108
 
99
109
  `Promise`<`unknown`\>
100
110
 
111
+ Promise que deve conter o código do processo.
112
+
101
113
  #### Defined in
102
114
 
103
- src/utils/ReadyUtil.ts:20
115
+ src/utils/ReadyUtil.ts:36