# @types/js-quantities

> TypeScript definitions for js-quantities

Latest version **1.6.6** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/js-quantities
pnpm add @types/js-quantities
yarn add @types/js-quantities
bun add @types/js-quantities
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.6.6 |
| Published | 2023-11-07 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51450 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/js-quantities
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-quantities
- npm.io page: https://npm.io/package/@types/js-quantities

## Recent versions

- 1.6.6 (latest) — 2023-11-07
- 1.6.3 (ts3.8) — 2021-12-24
- 1.6.2 (ts2.0) — 2017-09-06
- 1.6.5 — 2023-10-18
- 1.6.4 — 2023-09-15
- 1.6.1 — 2017-03-24
- 1.6.0 — 2017-01-05
- 0.0.5 — 2016-10-05
- 0.0.4 — 2016-09-19
- 0.0.3 — 2016-08-25
- 0.0.2 — 2016-08-19
- 0.0.1 — 2016-08-02

## README

# Installation
> `npm install --save @types/js-quantities`

# Summary
This package contains type definitions for js-quantities (http://gentooboontoo.github.io/js-quantities/).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-quantities.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-quantities/index.d.ts)
````ts
declare const Qty: Qty.Type;

interface Qty {
    readonly numerator: string[];
    readonly denominator: string[];
    readonly scalar: number;
    readonly baseScalar: number;
    readonly initValue: string;
    units(): string;
    isCompatible(value: Qty.UnitSource): boolean;
    kind(): string;
    isUnitless(): boolean;
    isBase(): boolean;
    toBase(): Qty;
    toFloat(): number;
    to(value: Qty.UnitSource): Qty;
    inverse(): Qty;
    eq(value: Qty.UnitSource): boolean;
    same(value: Qty.UnitSource): boolean;
    lt(value: Qty.UnitSource): boolean;
    lte(value: Qty.UnitSource): boolean;
    gt(value: Qty.UnitSource): boolean;
    gte(value: Qty.UnitSource): boolean;
    compareTo(value: Qty): Qty.ComparisonResult;
    add(value: Qty.Source): Qty;
    sub(value: Qty.Source): Qty;
    mul(value: Qty.Source): Qty;
    div(value: Qty.Source): Qty;
    toPrec(value: Qty.Source): Qty;
    toString(valueOrPrecision?: Qty.Source): string;
    toString(value: string, precision: number): string;
    format(formatter?: Qty.Formatter): string;
    format(value: string, formatter?: Qty.Formatter): string;
}

declare namespace Qty {
    interface Type {
        (value: Source): Qty;
        (value: number, unit: string): Qty;
        new(value: Source): Qty;
        new(value: number, unit: string): Qty;
        parse(value: string): Qty;
        getKinds(): string[];
        getUnits(kind?: string): string[];
        getAliases(unit: string): string[];
        swiftConverter(sourceUnit: string, targetUnit: string): Converter;
        formatter: Formatter;
        readonly Error: any;
        mulSafe(n1: number, n2: number): number;
        divSafe(n1: number, n2: number): number;
    }

    interface Converter {
        (sourceValue: number): number;
        (sourceValues: number[]): number[];
    }

    type Formatter = (scalar: number, unit: string) => string;

    type ComparisonResult = -1 | 0 | 1;

    type Source = UnitSource | number;

    type UnitSource = Qty | string;
}

export = Qty;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: none

# Credits
These definitions were written by .

---
_Source: https://npm.io/package/@types/js-quantities · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
