rounding-values
Rounding the numbers in object and objects in array. Reference to camelcase-keys.
Install
$ npm install --save rounding-values
Usage
"use strict";const roundingValues = ; const obj = a: 12345 ;;/* { "a": 1.23 }*/const arr = a: 12345 b: "1.2345" ;;/* [ { "a": 1.235, "b": "1.2345" } ]*/const innerArr = a: 12345 b: "1.2345" c: a: 12345 b: "1.2345" a: 12345 b: "1.2345" ;;/* [ { "a": 1.235, "b": "1.2345", "c": [ { "a": 1.235, "b": "1.2345" }, { "a": 1.235, "b": "1.2345" } ] } ]*/
API
roundingValues(input, options?)
input
Type: object | object[]
An object or array of objects.
options
Type: object
decimal
Type: number
Default: 2
Number of decimal to rounding
deep
Type: boolean
Default: false
Recurse nested objects and objects in arrays.