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

@dynatrace-sdk/units

Package Overview
Dependencies
Maintainers
3
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.13.0 to 0.13.1

9

CHANGELOG.md

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

## 0.13.1
### Patch Changes
- Improve conversion accuracy.
- Improve documentation.
- Improve cascading precision.
- Fix +/- Infinity abbreviation bug.
## 0.13.0

@@ -7,0 +16,0 @@

68

docs/DOCS.md
---
title: "Units"
description: Tools for converting and formatting the units and numerical values.
description: Package for converting and formatting units and numerical values.
---

@@ -8,3 +8,3 @@

Tools for converting and formatting the units and numerical values.
Package for converting and formatting units and numerical values.

@@ -21,4 +21,4 @@ import NpmLogo from "@site/static/img/npm-logo.png";

<div class="col" style={{ textAlign: "right" }}>
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units/v/0.13.0">
v0.13.0
<a href="https://www.npmjs.com/package/@dynatrace-sdk/units/v/0.13.1">
v0.13.1
</a>

@@ -35,16 +35,13 @@ </div>

<details>
<summary>
Code example
<summary>Code example</summary>
</summary>
```javascript
import { units, convert } from "@dynatrace-sdk/units";
import { convert, units } from "@dynatrace-sdk/units";
// units.{unitGroup}.{unit}
convert(
1000,
/* FromUnit */ units.length.meter,
/* ToUnit */ units.length.kilometer
);
// units.<category>.<unit>
units.length.meter, // FromUnit
units.length.kilometer // ToUnit
); // 1
```

@@ -187,5 +184,8 @@

Abbreviates large numbers to a shorter format.
Abbreviates large numbers to a shorter format. Example:
- `input: 1500, output: 1.5K`
```typescript
import { abbreviateNumber } from "@dynatrace-sdk/units";
abbreviateNumber(1500); // '1.5K'
```

@@ -196,7 +196,7 @@ </div>

| 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&lt;Object&gt; | <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> | |
| Name | Type | Description |
| -------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| input<sup>\*required</sup> | <a href="https://developer.mozilla.org/en-US/docs/Glossary/Number">number</a> | Number to be abbreviated. |
| scale<sup>\*required</sup> | Array&lt;Object&gt; | <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> |
| options | <a href="#abbreviateoptions">AbbreviateOptions</a> | |

@@ -238,5 +238,9 @@ {/* no returns */}

Converts a given number to the specified unit.
(e.g. `convert(1500, units.length.meter, unit.length.kilometer), output: 1.5`).
Converts a given number to the specified unit. Example:
```typescript
import { convert, units } from "@dynatrace-sdk/units";
convert(1500, units.length.meter, units.length.kilometer); // 1.5
```
</div>

@@ -384,3 +388,3 @@

Provides all the unit names to which the provided unit can be converted to.
Returns the names of all units to which the provided unit can be converted to.

@@ -406,3 +410,3 @@ </div>

Provides all the units to which the provided unit can be converted to.
Returns all units to which the provided unit can be converted to.

@@ -428,6 +432,5 @@ </div>

```javascript
```typescript
import { units } from "@dynatrace-sdk/units";
units.length.meter; // is a convertible unit
units.length.meter; // extends ConvertibleUnit
```

@@ -451,4 +454,13 @@

<div class="padding-bottom--md">A unit that can be formatted. Example:</div>
```typescript
import { units } from "@dynatrace-sdk/units";
units.currency.eur; // extends FormattableUnit
```
### Unit
<div class="padding-bottom--md">
A unit that is supported by our formatting functionality.
A ConvertibleUnit or a FormattableUnit or both.
</div>

@@ -455,0 +467,0 @@

{
"name": "@dynatrace-sdk/units",
"version": "0.13.0",
"version": "0.13.1",
"license": "Apache-2.0",
"description": "Tools for converting and formatting the units and numerical values.",
"description": "Package for converting and formatting units and numerical values.",
"homepage": "https://dt-url.net/6m8248i",

@@ -7,0 +7,0 @@ "keywords": [

# @dynatrace-sdk/units
Tools for converting and formatting the units and numerical values. You can find more information about the @dynatrace-sdk/units package on our [`Developer Portal`].
Package for converting and formatting units and numerical values. You can find more information about the @dynatrace-sdk/units package on our [`Developer Portal`].
[`developer portal`]: https://dt-url.net/6m8248i

@@ -7,3 +7,3 @@ export { getFormatting, format, formatDate, formatUnit, FormatDateOptions, FormatOptions, } from './util-format/format';

export { adjustFractionDigits, AdjustFractionDigitsOptions, } from './util-format/adjust-maximum-fraction-digits';
export { ConvertibleUnit as ConvertibleUnit, FormattableUnit as FormattableUnit, Unit, } from './util-convert/types';
export { ConvertibleUnit, FormattableUnit, Unit } from './util-convert/types';
export { parseTime } from './util-format/timeParser';
import { ConvertibleUnit, ConvertibleTarget } from './types';
/**
* Converts a given number to the specified unit.
* (e.g. `convert(1500, units.length.meter, unit.length.kilometer), output: 1.5`).
* Converts a given number to the specified unit. Example:
* ```typescript
* import { convert, units } from "@dynatrace-sdk/units";
* convert(1500, units.length.meter, units.length.kilometer) // 1.5
* ```
* @param input The number that will get converted.

@@ -6,0 +9,0 @@ * @param from The unit of the input (e.g. `units.length.meter`).

@@ -8,3 +8,3 @@ import { Unit } from './types';

/**
* Provides all the unit names to which the provided unit can be converted to.
* Returns the names of all units to which the provided unit can be converted to.
* @param unit

@@ -15,3 +15,3 @@ * @returns

/**
* Provides all the units to which the provided unit can be converted to.
* Returns all units to which the provided unit can be converted to.
* @param unit

@@ -18,0 +18,0 @@ * @returns

@@ -49,19 +49,22 @@ /** Units of exponential numbers, i.e. kilo, million, ect. */

/**
* Abbreviates large numbers to a shorter format.
* - `input: 1500, output: 1.5K`
* Abbreviates large numbers to a shorter format. Example:
* ```typescript
* import { abbreviateNumber } from "@dynatrace-sdk/units";
* abbreviateNumber(1500) // '1.5K'
* ```
*/
export declare function abbreviateNumber<T>(
export declare function abbreviateNumber(
/**
* Number that will get abbreviated.
* Number to be abbreviated.
*/
input: number,
/**
* Scale for the abbreviation.
* Default is decimal scale:
* - `input: 1_000, output: 1K`
* - `input: 1_000_0000, output: 1M`
* Scale to use for the abbreviation.
* Default is the decimal scale:
* - `abbreviateNumber(1_000) // '1K'`
* - `abbreviateNumber(1_000_000) // '1M'`
*/
scale?: Array<{
multiplier: number;
postfix: T | string;
postfix: string;
}>, options?: AbbreviateOptions): {

@@ -68,0 +71,0 @@ formattedValue: string;

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