Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dynatrace-sdk/units

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynatrace-sdk/units - npm Package Compare versions

Comparing version 0.16.1 to 0.16.3

12

CHANGELOG.md

@@ -5,2 +5,14 @@ # Units

## 0.16.3
### Patch Changes
- Fix cascading overflow error
## 0.16.2
### Patch Changes
- parseTimeAsTimeValue() supports valid iso 8601 strings without hours, minutes, seconds or milliseconds.
## 0.16.1

@@ -7,0 +19,0 @@

29

docs/DOCS.md

@@ -18,3 +18,3 @@ ---

<div class="col" style={{textAlign: 'right'}}>
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units/v/0.16.1" target="_blank" rel="noopener noreferrer">v0.16.1</a>
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units/v/0.16.3" target="_blank" rel="noopener noreferrer">v0.16.3</a>
</div>

@@ -176,3 +176,3 @@ </div>

<div class="padding-bottom--md">
<strong>_cascade(number,unit,depth,list?): ValueUnitList</strong>
<strong>_cascade(number,unit,depth,list?,fractionDigits?): ValueUnitList</strong>

@@ -224,2 +224,3 @@ <div class="padding-left--md">

|list|CascadeUnit|
|fractionDigits|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|

@@ -284,3 +285,3 @@

import { abbreviateNumber } from '@dynatrace-sdk/units';
abbreviateNumber(1500) // '1.5K'
abbreviateNumber(1500) // {"formattedValue": "2", "postfix": "k"}
```

@@ -298,3 +299,3 @@

|input<sup>*required</sup>|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|Number to be abbreviated. |
|scale<sup>*required</sup>|Scale|<p>Scale to use for the abbreviation. Default is the decimal scale:</p> <ul> <li><code>abbreviateNumber(1_000) // '1K'</code></li> <li><code>abbreviateNumber(1_000_000) // '1M'</code></li> </ul> |
|scale<sup>*required</sup>|Scale|<p>Scale to use for the abbreviation. Default is the decimal scale:</p> <ul> <li><code>abbreviateNumber(1_000) // &#123;&quot;formattedValue&quot;: &quot;1&quot;, &quot;postfix&quot;: &quot;k&quot;}</code></li> <li><code>abbreviateNumber(1_000_000, ExponentialOctalByteLevels) // &#123;&quot;formattedValue&quot;: &quot;977&quot;, &quot;postfix&quot;: &quot;KiB&quot;}</code></li> </ul> |
|options<sup>*required</sup>|[AdjustFractionDigitsOptions](#adjustfractiondigitsoptions)| |

@@ -341,3 +342,5 @@

The formatted number as a string.
| Description |
|---|
|The formatted number as a string.|

@@ -385,3 +388,5 @@

The result of the conversion (e.g. `1.5`).
| Description |
|---|
|The result of the conversion (e.g. `1.5`).|

@@ -424,3 +429,5 @@

A string containing the formatted number.
| Description |
|---|
|A string containing the formatted number.|

@@ -463,3 +470,5 @@

Date string
| Description |
|---|
|Date string|

@@ -535,3 +544,5 @@

An Array of parts containing the formatting result object.
| Description |
|---|
|An Array of parts containing the formatting result object.|

@@ -538,0 +549,0 @@

{
"name": "@dynatrace-sdk/units",
"version": "0.16.1",
"version": "0.16.3",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "description": "Package for converting and formatting units and numerical values.",

@@ -1,2 +0,2 @@

import { ConvertibleUnit, ValueUnitList } from './types';
import { ConvertibleUnit, ValueUnitList, OptionalValueUnitList } from './types';
type CascadeUnit = ((exponent: number) => ConvertibleUnit)[];

@@ -40,3 +40,10 @@ /**

*/
export declare function cascade(number: number, unit: ConvertibleUnit, depth: number, list?: CascadeUnit): ValueUnitList;
export declare function cascade(number: number, unit: ConvertibleUnit, depth: number, list?: CascadeUnit, fractionDigits?: number): ValueUnitList;
/** Corrects overflow errors, by rounding and calculating if the unit value fits into next unit.
* This error happens due to cascade calculations where the float precision leads to an inaccurate result where parts are falsely carried over to the next unit */
export declare function correctOverflow(list: OptionalValueUnitList, precision: number): ValueUnitList;
/**
* Merges values of units to a complete ConvertibleUnit list
*/
export declare function addValuesToUnitList(list: CascadeUnit, valueList: ValueUnitList, exponent: number): OptionalValueUnitList;
export {};

@@ -75,2 +75,6 @@ import { properties } from './properties';

export type ValueUnitList = ValueUnit[];
export type OptionalValueUnitList = {
value?: number;
unit: ConvertibleUnit;
}[];
export type ArrayLength<A> = A extends {

@@ -77,0 +81,0 @@ length: infer L;

@@ -34,3 +34,3 @@ import { AdjustFractionDigitsOptions } from './adjust-maximum-fraction-digits';

* import { abbreviateNumber } from '@dynatrace-sdk/units';
* abbreviateNumber(1500) // '1.5K'
* abbreviateNumber(1500) // {"formattedValue": "2", "postfix": "k"}
* ```

@@ -44,4 +44,4 @@ */

* Default is the decimal scale:
* - `abbreviateNumber(1_000) // '1K'`
* - `abbreviateNumber(1_000_000) // '1M'`
* - `abbreviateNumber(1_000) // {"formattedValue": "1", "postfix": "k"}`
* - `abbreviateNumber(1_000_000, ExponentialOctalByteLevels) // {"formattedValue": "977", "postfix": "KiB"}`
*/

@@ -48,0 +48,0 @@ scale?: Scale, options?: AdjustFractionDigitsOptions): {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc