@tidepool/viz@0.8.1 apidocs /Users/jebeck/Tidepool/viz jsdoc2md "src/utils/format.js"
Functions
- formatBgValue(val, bgPrefs, [outOfRangeThresholds]) ⇒
String formatBgValue
- formatDecimalNumber(val, [places]) ⇒
String formatDecimalNumber
- formatPercentage(val) ⇒
String formatPercentage
- removeTrailingZeroes(val) ⇒
String removeTrailingZeroes
formatBgValue(val, bgPrefs, [outOfRangeThresholds]) ⇒ String
formatBgValue
Kind: global function
Returns: String - formatted blood glucose value
| Param | Type | Description |
|---|---|---|
| val | Number |
integer or float blood glucose value in either mg/dL or mmol/L |
| bgPrefs | Object |
object containing bgUnits String and bgBounds Object |
| [outOfRangeThresholds] | Object |
optional thresholds for low and high values; derived from annotations in PwD's data, so may not exist |
formatDecimalNumber(val, [places]) ⇒ String
formatDecimalNumber
Kind: global function
Returns: String - numeric value rounded to the desired number of decimal places
| Param | Type | Description |
|---|---|---|
| val | Number |
numeric value to format |
| [places] | Number |
optional number of decimal places to display; if not provided, will display as integer (0 decimal places) |
formatPercentage(val) ⇒ String
formatPercentage
Kind: global function
Returns: String - percentage
| Param | Type | Description |
|---|---|---|
| val | Number |
raw decimal proportion, range of 0.0 to 1.0 |
removeTrailingZeroes(val) ⇒ String
removeTrailingZeroes
Kind: global function
Returns: String - - formatted decimal value w/o trailing zero-indexes
| Param | Type | Description |
|---|---|---|
| val | String |
formatted decimal value, may have trailing zeroes |