@sankhyalabs/core-docs 5.3.0 → 5.4.1
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.
- package/classes/ArrayUtils.md +3 -3
- package/classes/NumberUtils.md +70 -7
- package/package.json +1 -1
package/classes/ArrayUtils.md
CHANGED
@@ -47,7 +47,7 @@ Filtra um array a partir de um critério textual.
|
|
47
47
|
|
48
48
|
#### Defined in
|
49
49
|
|
50
|
-
src/utils/ArrayUtils.ts:
|
50
|
+
src/utils/ArrayUtils.ts:17
|
51
51
|
|
52
52
|
___
|
53
53
|
|
@@ -71,7 +71,7 @@ Converte texto para caixa alta e substitui caracteres acentuados.
|
|
71
71
|
|
72
72
|
#### Defined in
|
73
73
|
|
74
|
-
src/utils/ArrayUtils.ts:
|
74
|
+
src/utils/ArrayUtils.ts:35
|
75
75
|
|
76
76
|
___
|
77
77
|
|
@@ -96,4 +96,4 @@ Ordena valores de um array alfabeticamente.
|
|
96
96
|
|
97
97
|
#### Defined in
|
98
98
|
|
99
|
-
src/utils/ArrayUtils.ts:
|
99
|
+
src/utils/ArrayUtils.ts:45
|
package/classes/NumberUtils.md
CHANGED
@@ -13,11 +13,13 @@
|
|
13
13
|
### Methods
|
14
14
|
|
15
15
|
- [changeFormat](NumberUtils.md#changeformat)
|
16
|
+
- [compare](NumberUtils.md#compare)
|
16
17
|
- [format](NumberUtils.md#format)
|
17
18
|
- [getValueOrDefault](NumberUtils.md#getvalueordefault)
|
18
19
|
- [getValueOrZero](NumberUtils.md#getvalueorzero)
|
19
20
|
- [keepOnlyDecimalSeparator](NumberUtils.md#keeponlydecimalseparator)
|
20
21
|
- [round](NumberUtils.md#round)
|
22
|
+
- [safeFormat](NumberUtils.md#safeformat)
|
21
23
|
- [stringToNumber](NumberUtils.md#stringtonumber)
|
22
24
|
|
23
25
|
## Constructors
|
@@ -60,13 +62,38 @@ Informo: "27.99" | Obtenho: "27,99"
|
|
60
62
|
|
61
63
|
#### Defined in
|
62
64
|
|
63
|
-
src/utils/NumberUtils.ts:
|
65
|
+
src/utils/NumberUtils.ts:186
|
66
|
+
|
67
|
+
___
|
68
|
+
|
69
|
+
### compare
|
70
|
+
|
71
|
+
▸ `Static` **compare**(`a`, `b`): `number`
|
72
|
+
|
73
|
+
Determina a ordem de umeros.
|
74
|
+
|
75
|
+
#### Parameters
|
76
|
+
|
77
|
+
| Name | Type | Description |
|
78
|
+
| :------ | :------ | :------ |
|
79
|
+
| `a` | `number` | Primeio número para comparação. |
|
80
|
+
| `b` | `number` | Segundo número para comparação. |
|
81
|
+
|
82
|
+
#### Returns
|
83
|
+
|
84
|
+
`number`
|
85
|
+
|
86
|
+
- Um numeral negativo se o primeiro argumento é menor que o segundo, zero se os dois são iguais e um numeral positivo quando o primeiro é maior que o segundo.
|
87
|
+
|
88
|
+
#### Defined in
|
89
|
+
|
90
|
+
src/utils/NumberUtils.ts:267
|
64
91
|
|
65
92
|
___
|
66
93
|
|
67
94
|
### format
|
68
95
|
|
69
|
-
▸ `Static` **format**(`value`, `precision`, `prettyPrecision?`): `string`
|
96
|
+
▸ `Static` **format**(`value`, `precision`, `prettyPrecision?`, `defaultValue?`): `string`
|
70
97
|
|
71
98
|
Formata o numeral com a precisão informada.
|
72
99
|
|
@@ -74,6 +101,8 @@ Formata o numeral com a precisão informada.
|
|
74
101
|
|
75
102
|
```ts
|
76
103
|
Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
104
|
+
Informado: (undefined, 3, 3) | Retorna: NaN
|
105
|
+
Informado: (undefined, 3, 3, '0,00') | Retorna: 0,00
|
77
106
|
```
|
78
107
|
|
79
108
|
#### Parameters
|
@@ -83,6 +112,7 @@ Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
|
83
112
|
| `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: ######.##). |
|
84
113
|
| `precision` | `number` | `undefined` | Quantidade de casas decimais. |
|
85
114
|
| `prettyPrecision` | `number` | `NaN` | Quantidade de zeros nos decimais. |
|
115
|
+
| `defaultValue` | `string` | `undefined` | Valor padrão caso o value não seja um valor numérico válido. |
|
86
116
|
|
87
117
|
#### Returns
|
88
118
|
|
@@ -92,7 +122,7 @@ Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
|
92
122
|
|
93
123
|
#### Defined in
|
94
124
|
|
95
|
-
src/utils/NumberUtils.ts:
|
125
|
+
src/utils/NumberUtils.ts:77
|
96
126
|
|
97
127
|
___
|
98
128
|
|
@@ -135,7 +165,7 @@ Informo: value: "30abc", defaultValue: 0 | Obtenho: 0
|
|
135
165
|
|
136
166
|
#### Defined in
|
137
167
|
|
138
|
-
src/utils/NumberUtils.ts:
|
168
|
+
src/utils/NumberUtils.ts:208
|
139
169
|
|
140
170
|
___
|
141
171
|
|
@@ -159,7 +189,7 @@ Obtém o valor ou zero, caso o valor seja inválido(NaN/undefined).
|
|
159
189
|
|
160
190
|
#### Defined in
|
161
191
|
|
162
|
-
src/utils/NumberUtils.ts:
|
192
|
+
src/utils/NumberUtils.ts:227
|
163
193
|
|
164
194
|
___
|
165
195
|
|
@@ -190,7 +220,7 @@ Informado: '95.12' | Retorna: '9512'
|
|
190
220
|
|
191
221
|
#### Defined in
|
192
222
|
|
193
|
-
src/utils/NumberUtils.ts:
|
223
|
+
src/utils/NumberUtils.ts:158
|
194
224
|
|
195
225
|
___
|
196
226
|
|
@@ -234,7 +264,40 @@ Informo: ("100.16", 3) | 100.16
|
|
234
264
|
|
235
265
|
#### Defined in
|
236
266
|
|
237
|
-
src/utils/NumberUtils.ts:
|
267
|
+
src/utils/NumberUtils.ts:255
|
268
|
+
|
269
|
+
___
|
270
|
+
|
271
|
+
### safeFormat
|
272
|
+
|
273
|
+
▸ `Static` **safeFormat**(`value`, `precision`, `prettyPrecision?`): `string`
|
274
|
+
|
275
|
+
Formata o numeral com a precisão informada e o valor default 0,00 caso o value não seja um numero valido.
|
276
|
+
|
277
|
+
**`Example`**
|
278
|
+
|
279
|
+
```ts
|
280
|
+
Informado: ('10,9845444', 3, 3) | Retorna: '10,985'
|
281
|
+
Informado: (undefined, 3, 3) | Retorna: 0,00
|
282
|
+
```
|
283
|
+
|
284
|
+
#### Parameters
|
285
|
+
|
286
|
+
| Name | Type | Default value | Description |
|
287
|
+
| :------ | :------ | :------ | :------ |
|
288
|
+
| `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: ######.##). |
|
289
|
+
| `precision` | `number` | `undefined` | Quantidade de casas decimais. |
|
290
|
+
| `prettyPrecision` | `number` | `NaN` | Quantidade de zeros nos decimais. |
|
291
|
+
|
292
|
+
#### Returns
|
293
|
+
|
294
|
+
`string`
|
295
|
+
|
296
|
+
- Numeral em formato de String formatado em PT-BR.
|
297
|
+
|
298
|
+
#### Defined in
|
299
|
+
|
300
|
+
src/utils/NumberUtils.ts:143
|
238
301
|
|
239
302
|
___
|
240
303
|
|