@dynatrace-sdk/units
Advanced tools
Comparing version 0.8.0 to 0.8.3
@@ -5,2 +5,20 @@ # Units | ||
## 0.8.3 | ||
### Patch Changes | ||
- Correct symbols used for a thousand and a billion when abbreviating the numbers. | ||
## 0.8.2 | ||
### Patch Changes | ||
- Update documentation | ||
## 0.8.1 | ||
### Patch Changes | ||
- Use seaotter links. | ||
## 0.8.0 | ||
@@ -10,7 +28,7 @@ | ||
- 176232f5: The precision was removed from the abbreviateNumber() options, and instead, minimumFractionDigits and maximumFractionDigits were added to match the Intl API. | ||
- The precision was removed from the abbreviateNumber() options, and instead, minimumFractionDigits and maximumFractionDigits were added to match the Intl API. | ||
### Patch Changes | ||
- 3bd82f9b: Correcting the import in a docs example. | ||
- Correcting the import in a docs example. | ||
@@ -21,4 +39,4 @@ ## 0.7.1 | ||
- 362f0c5e: Add ConvertableUnit, ConvertablePack, FormatableUnit to documentation. | ||
- e42aa915: Add description, homepage and keywords to package.json | ||
- Add ConvertableUnit, ConvertablePack, FormatableUnit to documentation. | ||
- Add description, homepage and keywords to package.json | ||
@@ -29,3 +47,3 @@ ## 0.7.0 | ||
- 68010ceb: Casade time up to weeks. | ||
- Casade time up to weeks. | ||
@@ -36,7 +54,7 @@ ## 0.6.0 | ||
- f7f9023a: Some units have been removed from the cascade list. Affected unit groups are length and mass. | ||
- Some units have been removed from the cascade list. Affected unit groups are length and mass. | ||
### Patch Changes | ||
- 42c47043: Export CUnit and Unit types | ||
- Export CUnit and Unit types | ||
@@ -102,2 +120,2 @@ ## 0.5.2 | ||
- Initial release of @dynatrace-sdk/util-formatters. | ||
- Initial release of @dynatrace-sdk/util-formatters. |
@@ -638,5 +638,5 @@ /** | ||
{ multiplier: Math.pow(10, 12), postfix: "T" }, | ||
{ multiplier: Math.pow(10, 9), postfix: "B" }, | ||
{ multiplier: Math.pow(10, 9), postfix: "G" }, | ||
{ multiplier: Math.pow(10, 6), postfix: "M" }, | ||
{ multiplier: Math.pow(10, 3), postfix: "K" } | ||
{ multiplier: Math.pow(10, 3), postfix: "k" } | ||
]; | ||
@@ -643,0 +643,0 @@ var ExponentialOctalBitLevels = [ |
608
docs/DOCS.md
# Units | ||
SDK package version **0.8.0** | ||
Tools for converting and formatting the units and numerical values. | ||
```bash | ||
npm install @dynatrace-sdk/units | ||
``` | ||
import NpmLogo from '@site/static/img/npm-logo.png'; | ||
<div class="row margin-bottom--md"> | ||
<div class="col"> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units"> | ||
<span class="margin-right--xs">@dynatrace-sdk/units</span> | ||
<img className="no-zoom" width="20px" src={NpmLogo} /> | ||
</a> | ||
</div> | ||
<div class="col" style={{textAlign: 'right'}}> | ||
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units/v/0.8.3">v0.8.3</a> | ||
</div> | ||
</div> | ||
```bash | ||
npm install @dynatrace-sdk/units | ||
``` | ||
## Interfaces | ||
### AbbreviateOptions | ||
### AbbreviateOptions | ||
<!-- default child "Interface" --> | ||
#### Properties | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>locale</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | ||
<div class="padding-left--md"> | ||
| Name | Type | Description | | ||
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | | ||
| locale | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | The locale according to which the number will abbreviate. | | ||
| maximumFractionDigits | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Maximum number of decimal places. | | ||
| minimumFractionDigits | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Minimum number of decimal places. | | ||
The locale according to which the number will abbreviate. | ||
### AdjustFractionDigitsOptions | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>maximumFractionDigits</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Maximum number of decimal places. | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>minimumFractionDigits</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Minimum number of decimal places. | ||
</div> | ||
</div> | ||
### AdjustFractionDigitsOptions | ||
<!-- default child "Interface" --> | ||
#### Properties | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>locale</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | ||
<div class="padding-left--md"> | ||
| Name | Type | Description | | ||
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | ||
| locale | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | The locale according to which the number will be adjusted. | | ||
| maximumFractionDigits | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Maximum number of decimal places. | | ||
| minimumFractionDigits | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Minimum number of decimal places. | | ||
The locale according to which the number will be adjusted. | ||
### FormatDateOptions | ||
</div> | ||
<!-- default child "Interface" --> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>maximumFractionDigits</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Maximum number of decimal places. | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>minimumFractionDigits</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Minimum number of decimal places. | ||
</div> | ||
</div> | ||
### FormatDateOptions | ||
<!-- default child "Interface" --> | ||
Interface that extends Intl.DateTimeFormatOptions to pass an optional property to overwrite the default locale. | ||
See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options). | ||
#### Properties | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>locale</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | ||
<div class="padding-left--md"> | ||
| Name | Type | Description | | ||
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | | ||
| calendar | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | | | ||
| dateStyle | "full" | "long" | "medium" | "short" | | | ||
| day | "numeric" | "2-digit" | | | ||
| dayPeriod | "long" | "short" | "narrow" | | | ||
| era | "long" | "short" | "narrow" | | | ||
| formatMatcher | "best fit" | "basic" | | | ||
| fractionalSecondDigits | 1 | 2 | 3 | | | ||
| hour | "numeric" | "2-digit" | | | ||
| hour12 | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Boolean">boolean</a> | | | ||
| hourCycle | "h11" | "h12" | "h23" | "h24" | | | ||
| locale | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | The locale according to which the number will be formatted. | | ||
| localeMatcher | "best fit" | "lookup" | | | ||
| minute | "numeric" | "2-digit" | | | ||
| month | "long" | "short" | "narrow" | "numeric" | "2-digit" | | | ||
| numberingSystem | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | | | ||
| second | "numeric" | "2-digit" | | | ||
| timeStyle | "full" | "long" | "medium" | "short" | | | ||
| timeZone | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | | | ||
| timeZoneName | "long" | "short" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | | | ||
| weekday | "long" | "short" | "narrow" | | | ||
| year | "numeric" | "2-digit" | | | ||
The locale according to which the number will be formatted. | ||
### FormatOptions | ||
</div> | ||
</div> | ||
### FormatOptions | ||
<!-- default child "Interface" --> | ||
#### Properties | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>abbreviate</strong>: boolean | ||
<div class="padding-left--md"> | ||
| Name | Type | Description | | ||
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| abbreviate | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Boolean">boolean</a> | <p>It will shorten the number to a shorter format. (e.g. <code>input: 1500, output: 1.5k</code>).</p> | | ||
| cascade | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | <p>Will search for the biggest unit within its group and cascade it down the the specified dept. The last number will get rounded to <code>maximumFractionDigits</code>. (e.g. <code>format(1500, { input: units.length.meter, cascade: 3}), output: "1 km 5 hm 5 dam")</code>).</p> | | ||
| input | <a href="#fromunit">FromUnit</a> | <p>If input unit is defined, it will convert it to the best fitting unit. (e.g. <code>format(1500, { input: units.length.meter }), output: "1.5 km")</code>).</p> | | ||
| locale | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | <p>The locale that will be used to format the number. By default it will use the platform locale specified by the user.</p> | | ||
| maximumFractionDigits | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | <p>The amount of maximumFractionDigits points. See <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits">MDN</a>.</p> | | ||
| output | <a href="#tounit">ToUnit</a> | <p>If not specified, the conversion is disabled (e.g. <code>format(1500), output: 1.5K</code>).</p> | | ||
| suffix | <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | A custom suffix that overwrites the unit symbol. | | ||
It will shorten the number to a shorter format. | ||
(e.g. `input: 1500, output: 1.5k`). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>cascade</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Will search for the biggest unit within its group and cascade it down the the specified dept. | ||
The last number will get rounded to `maximumFractionDigits`. | ||
(e.g. `format(1500, { input: units.length.meter, cascade: 3}), output: "1 km 5 hm 5 dam")`). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>input</strong>: <a href="#fromunit">FromUnit</a> | ||
<div class="padding-left--md"> | ||
If input unit is defined, it will convert it to the best fitting unit. | ||
(e.g. `format(1500, { input: units.length.meter }), output: "1.5 km")`). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>locale</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | Array<<a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a>> | ||
<div class="padding-left--md"> | ||
The locale that will be used to format the number. | ||
By default it will use the platform locale specified by the user. | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>maximumFractionDigits</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
The amount of maximumFractionDigits points. | ||
See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>output</strong>: <a href="#tounit">ToUnit</a> | ||
<div class="padding-left--md"> | ||
If not specified, the conversion is disabled | ||
(e.g. `format(1500), output: 1.5K`). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>suffix</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/String">string</a> | ||
<div class="padding-left--md"> | ||
A custom suffix that overwrites the unit symbol. | ||
</div> | ||
</div> | ||
## Variables | ||
@@ -245,7 +109,4 @@ | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
@@ -260,7 +121,4 @@ <strong>ExponentialOctalBitLevels</strong>: Array<Object> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
@@ -275,7 +133,4 @@ <strong>ExponentialOctalByteLevels</strong>: Array<Object> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
@@ -289,4 +144,2 @@ <strong>units</strong>: Object | ||
</div> | ||
@@ -296,3 +149,2 @@ | ||
### abbreviateNumber | ||
@@ -306,61 +158,19 @@ | ||
Abbreviates large numbers to a shorter format. | ||
- `input: 1500, output: 1.5K` | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>input</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
Number that will get abbreviated. | ||
</div> | ||
#### Parameters | ||
| Name | Type | Description | | ||
| -------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| input<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Number that will get abbreviated. | | ||
| scale<sup>\*required</sup> | Array<Object> | <p>Scale for the abbreviation. Default is decimal scale:</p> <ul> <li><code>input: 1_000, output: 1K</code></li> <li><code>input: 1_000_0000, output: 1M</code></li> </ul> | | ||
| options | <a href="#abbreviateoptions">AbbreviateOptions</a> | | | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>scale</strong>: Array<Object> | ||
<div class="padding-left--md"> | ||
Scale for the abbreviation. | ||
Default is decimal scale: | ||
- `input: 1_000, output: 1K` | ||
- `input: 1_000_0000, output: 1M` | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>options</strong>: <a href="#abbreviateoptions">AbbreviateOptions</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
</div> | ||
<!-- no returns --> | ||
</div> | ||
</div> | ||
### adjustFractionDigits | ||
@@ -375,34 +185,13 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>input</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
The number to be formatted. | ||
</div> | ||
#### Parameters | ||
| Name | Type | Description | | ||
| -------------------------- | ----------------------------------------------------------------------------- | --------------------------- | | ||
| input<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The number to be formatted. | | ||
| options | <a href="#adjustfractiondigitsoptions">AdjustFractionDigitsOptions</a> | | | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>options</strong>: <a href="#adjustfractiondigitsoptions">AdjustFractionDigitsOptions</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
</div> | ||
#### Returns | ||
<div class="padding-left--md"> | ||
A formatted number as a string. | ||
@@ -412,15 +201,2 @@ | ||
</div> | ||
</div> | ||
### convert | ||
@@ -436,46 +212,14 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>input</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
The number that will get converted. | ||
</div> | ||
#### Parameters | ||
| Name | Type | Description | | ||
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ | | ||
| input<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | The number that will get converted. | | ||
| from<sup>\*required</sup> | <a href="#fromunit">FromUnit</a> | The unit of the input (e.g. <code>units.length.meter</code>). | | ||
| to<sup>\*required</sup> | <a href="#convertabletarget">ConvertableTarget</a><<a href="#fromunit">FromUnit</a> | <a href="#tounit">ToUnit</a>> | The unit of the output (e.g. <code>units.length.kilometer</code>). | | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>from</strong>: <a href="#fromunit">FromUnit</a> | ||
<div class="padding-left--md"> | ||
The unit of the input (e.g. `units.length.meter`). | ||
</div> | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>to</strong>: <a href="#convertabletarget">ConvertableTarget</a><<a href="#fromunit">FromUnit</a> | <a href="#tounit">ToUnit</a>> | ||
<div class="padding-left--md"> | ||
The unit of the output (e.g. `units.length.kilometer`). | ||
</div> | ||
</div> | ||
#### Returns | ||
<div class="padding-left--md"> | ||
The result of the conversion (e.g. `1.5`). | ||
@@ -485,15 +229,2 @@ | ||
</div> | ||
</div> | ||
### format | ||
@@ -508,34 +239,13 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>number</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
#### Parameters | ||
| Name | Type | Description | | ||
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- | | ||
| number<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | | | ||
| options | <a href="#formatoptions">FormatOptions</a><<a href="#units">Units</a> | <a href="#tounit">ToUnit</a><<a href="#units">Units</a> | <a href="#fromunit">FromUnit</a>>> | Formatting options. | | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>options</strong>: <a href="#formatoptions">FormatOptions</a><<a href="#units">Units</a> | <a href="#tounit">ToUnit</a><<a href="#units">Units</a> | <a href="#fromunit">FromUnit</a>>> | ||
<div class="padding-left--md"> | ||
Formatting options. | ||
</div> | ||
</div> | ||
#### Returns | ||
<div class="padding-left--md"> | ||
A string containing the formatted number. | ||
@@ -545,15 +255,2 @@ | ||
</div> | ||
</div> | ||
### formatDate | ||
@@ -568,34 +265,13 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>input</strong>: <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">Date</a> | ||
<div class="padding-left--md"> | ||
Number of milliseconds since UNIX epoch or a Javascript Date. | ||
</div> | ||
#### Parameters | ||
| Name | Type | Description | | ||
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | ||
| input<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">Date</a> | Number of milliseconds since UNIX epoch or a Javascript Date. | | ||
| options | <a href="#formatdateoptions">FormatDateOptions</a> | An object that contains one or more properties that specify comparison options. | | ||
</div> | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>options</strong>: <a href="#formatdateoptions">FormatDateOptions</a> | ||
<div class="padding-left--md"> | ||
An object that contains one or more properties that specify comparison options. | ||
</div> | ||
</div> | ||
#### Returns | ||
<div class="padding-left--md"> | ||
Date string | ||
@@ -605,15 +281,2 @@ | ||
</div> | ||
</div> | ||
### formatUnit | ||
@@ -628,32 +291,14 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>unit</strong>: <a href="#formatableunit">FormatableUnit</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
#### Parameters | ||
| Name | Type | | ||
| ------------------------- | -------------------------------------------- | | ||
| unit<sup>\*required</sup> | <a href="#formatableunit">FormatableUnit</a> | | ||
</div> | ||
<!-- no returns --> | ||
</div> | ||
</div> | ||
### variantNames | ||
@@ -668,32 +313,14 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>unit</strong>: <a href="#convertableunit">ConvertableUnit</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
#### Parameters | ||
| Name | Type | | ||
| ------------------------- | ---------------------------------------------- | | ||
| unit<sup>\*required</sup> | <a href="#convertableunit">ConvertableUnit</a> | | ||
</div> | ||
<!-- no returns --> | ||
</div> | ||
</div> | ||
### variantUnits | ||
@@ -708,31 +335,14 @@ | ||
**Parameters** | ||
<div class="padding-left--md padding-bottom--md"> | ||
<strong>unit</strong>: <a href="#convertableunit">ConvertableUnit</a> | ||
<div class="padding-left--md"> | ||
</div> | ||
#### Parameters | ||
| Name | Type | | ||
| ------------------------- | ---------------------------------------------- | | ||
| unit<sup>\*required</sup> | <a href="#convertableunit">ConvertableUnit</a> | | ||
</div> | ||
<!-- no returns --> | ||
</div> | ||
</div> | ||
### ConvertableUnit | ||
@@ -745,5 +355,5 @@ | ||
```javascript | ||
import { units } from '@dynatrace-sdk/units'; | ||
import { units } from "@dynatrace-sdk/units"; | ||
units.length.meter // is a convertable unit | ||
units.length.meter; // is a convertable unit | ||
``` | ||
@@ -779,3 +389,7 @@ | ||
// units.{unitGroup}.{unit} | ||
convert(1000, /* FromUnit */ units.length.meter, /* ToUnit */units.length.kilometer) | ||
convert( | ||
1000, | ||
/* FromUnit */ units.length.meter, | ||
/* ToUnit */ units.length.kilometer | ||
); | ||
``` |
@@ -602,5 +602,5 @@ /** | ||
{ multiplier: Math.pow(10, 12), postfix: "T" }, | ||
{ multiplier: Math.pow(10, 9), postfix: "B" }, | ||
{ multiplier: Math.pow(10, 9), postfix: "G" }, | ||
{ multiplier: Math.pow(10, 6), postfix: "M" }, | ||
{ multiplier: Math.pow(10, 3), postfix: "K" } | ||
{ multiplier: Math.pow(10, 3), postfix: "k" } | ||
]; | ||
@@ -607,0 +607,0 @@ var ExponentialOctalBitLevels = [ |
{ | ||
"name": "@dynatrace-sdk/units", | ||
"version": "0.8.0", | ||
"version": "0.8.3", | ||
"license": "Apache-2.0", | ||
"description": "Tools for converting and formatting the units and numerical values.", | ||
"homepage": "https://developer.dynatrace.com/reference/sdks/units", | ||
"homepage": "https://dt-url.net/6m8248i", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "Dynatrace AppEngine", |
@@ -5,2 +5,2 @@ # @dynatrace-sdk/units | ||
[`developer portal`]: https://developer.dynatrace.com/reference/sdks/units | ||
[`developer portal`]: https://dt-url.net/6m8248i |
/** Units of exponential numbers, i.e. kilo, million, ect. */ | ||
declare type ExponentialNumberUnitType = 'K' | 'M' | 'B' | 'T' | 'P' | 'E' | 'Z' | 'Y' | 'R' | 'Q'; | ||
declare type ExponentialNumberUnitType = 'k' | 'M' | 'G' | 'T' | 'P' | 'E' | 'Z' | 'Y' | 'R' | 'Q'; | ||
/** Units of data in bytes */ | ||
@@ -4,0 +4,0 @@ declare type DataUnitByteType = 'byte' | 'KiB' | 'MiB' | 'GiB' | 'TiB' | 'PiB' | 'EiB' | 'ZiB' | 'YiB' | 'RiB' | 'QiB'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310854
40
5654