@sankhyalabs/core-docs 4.0.0 → 4.0.2
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/NumberUtils.md +45 -0
- package/package.json +1 -1
package/classes/NumberUtils.md
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
- [getValueOrDefault](NumberUtils.md#getvalueordefault)
|
18
18
|
- [getValueOrZero](NumberUtils.md#getvalueorzero)
|
19
19
|
- [keepOnlyDecimalSeparator](NumberUtils.md#keeponlydecimalseparator)
|
20
|
+
- [round](NumberUtils.md#round)
|
20
21
|
- [stringToNumber](NumberUtils.md#stringtonumber)
|
21
22
|
|
22
23
|
## Constructors
|
@@ -193,6 +194,50 @@ src/utils/NumberUtils.ts:140
|
|
193
194
|
|
194
195
|
___
|
195
196
|
|
197
|
+
### round
|
198
|
+
|
199
|
+
▸ `Static` **round**(`value`, `decimals?`): `number`
|
200
|
+
|
201
|
+
Realiza o arredondamento de casas decimais de um numero.
|
202
|
+
|
203
|
+
**`Example`**
|
204
|
+
|
205
|
+
```ts
|
206
|
+
Informo: (100.12) | 100.12
|
207
|
+
Informo: (100,12) | NaN
|
208
|
+
|
209
|
+
Informo: ("100.12", 1) | 100.1
|
210
|
+
Informo: ("100.12", 2) | 100.12
|
211
|
+
Informo: ("100.12", 3) | 100.12
|
212
|
+
|
213
|
+
Informo: ("100.15", 1) | 100.2
|
214
|
+
Informo: ("100.15", 2) | 100.15
|
215
|
+
Informo: ("100.15", 3) | 100.15
|
216
|
+
|
217
|
+
Informo: ("100.16", 1) | 100.2
|
218
|
+
Informo: ("100.16", 2) | 100.16
|
219
|
+
Informo: ("100.16", 3) | 100.16
|
220
|
+
```
|
221
|
+
|
222
|
+
#### Parameters
|
223
|
+
|
224
|
+
| Name | Type | Default value | Description |
|
225
|
+
| :------ | :------ | :------ | :------ |
|
226
|
+
| `value` | `number` | `undefined` | Numeral a ser arredondado. |
|
227
|
+
| `decimals` | `number` | `2` | Quantidade de casas decimais ussada no arredondamento. |
|
228
|
+
|
229
|
+
#### Returns
|
230
|
+
|
231
|
+
`number`
|
232
|
+
|
233
|
+
- O próprio numeral arredondado com a quantidade de casas decimais do argumento decimals.
|
234
|
+
|
235
|
+
#### Defined in
|
236
|
+
|
237
|
+
src/utils/NumberUtils.ts:237
|
238
|
+
|
239
|
+
___
|
240
|
+
|
196
241
|
### stringToNumber
|
197
242
|
|
198
243
|
▸ `Static` **stringToNumber**(`value`): `number`
|