# @qudtlib/core

> Data model for QUDTLib

Latest version **7.2.0** (published 2026-11-19) · CC-BY-4.0 license · 0 weekly downloads

## Install

```sh
npm install @qudtlib/core
pnpm add @qudtlib/core
yarn add @qudtlib/core
bun add @qudtlib/core
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.2.0 |
| Published | 2026-11-19 |
| First published | 2022-10-14 |
| Weekly downloads | 0 |
| License | CC-BY-4.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.16 |
| Dependencies | 1 |
| Unpacked size | 661.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Florian Kleedorfer |
| Maintainers | fkleedorfer |
| Keywords | QUDT, Unit, conversion, Units, Quantities |

## Links

- npm: https://www.npmjs.com/package/@qudtlib/core
- Repository: https://github.com/qudtlib/qudtlib-js
- Homepage: https://github.com/qudtlib/qudtlib-js#readme
- Issues: https://github.com/qudtlib/qudtlib-js/issues
- npm.io page: https://npm.io/package/@qudtlib/core

## Dependencies (1)

- [decimal.js](https://npm.io/package/decimal.js.md) 10.6.0

## Recent versions

- 7.2.0 (latest) — 2026-11-19
- 7.0.0-beta.1 (beta) — 2025-07-26
- 7.1.0 — 2025-09-03
- 7.1.0-beta.0 — 2025-09-02
- 7.0.0-beta.0 — 2025-07-25
- 6.8.1 — 2024-12-18
- 6.8.0 — 2024-12-18
- 6.7.0 — 2024-04-04
- 6.6.0 — 2024-04-04
- 6.4.0-beta.0 — 2024-03-17
- 6.3.2 — 2024-02-20
- 6.3.2-beta.0 — 2024-02-20
- 6.3.1 — 2024-02-20
- 6.3.0 — 2024-02-08
- 6.2.1 — 2024-02-03
- … 24 more at https://npm.io/package/@qudtlib/core/versions

## README

# QUDTLib: JS Unit Conversion Library based on QUDT

Package of [qudtlib-js](https://github.com/qudtlib/qudtlib-js)

[Changelog](https://github.com/qudtlib/qudtlib-js/blob/main/CHANGELOG.md)

Provides unit conversion and related functionality for Javascript (Typescript).

Based on the excellent [QUDT ontology](https://qudt.org), available in
a js package without any RDF manipulation needed.

This package is a port of [qudtlib-java](https://github.com/qudtlib/qudtlib-java/). The major version of this package is the same as that of `qudtlib-java`.

This package offers the core functionality, but defines no units/quantitykinds/prefixes. It is meant to be
imported and re-exported by packages providing such data. At the time of this writing, there is only one package
that provides units, `@qudtlib/allunits`.

Most users will want to use `@qudtlib/allunits` (which re-exports everything in this package).

## Usage

`Qudt` is your friend. All functionality is accessed through static methods of that class. You can explore the API from that starting point.
The main Model classes are:

    Unit: encapsulates IRI, label, dimension vector, multiplier/offset, factor units (if any). Descriptions are omitted (create an issue if you want them.)
    QuantityKind: IRI, label, applicable units, broader quantity kinds
    QuantityValue: value and unit.

Values are always Decimal (from [Decimal.js](https://mikemcl.github.io/decimal.js/)) and there are no convenience methods allowing you to provide other numeric types. This is intentiaonal so as not to mask any conversion problems. You'll be fine. When you need a value, use `new Decimal(number|string)`.

All units, quantityKinds and prefixes are avalable as constants (exported by the package providing the units, such as `@qudtlib/allunits`):

    Units: all units, such as Units.KiloM__PER__SEC
    QuantityKinds:: all quantityKinds, such as QuantityKinds.BloodGlucoseLevel
    Prefixes: all prefixes, such as Prefixes.Atto

The functionality comprises:

    Qudt.convert(...): Convert a value
    Qudt.scaleUnit(...): Scale a unit (e.g., make KiloM from M and kilo)
    Qudt.unscaleUnit(..): Unscale a unit:
    Qudt.unit(...): Get Unit by IRI
    Qudt.quantityKind(...): Get QuantityKind by IRI
    Qudt.unitFromLocalName(...): Get Unit by local name (i.e., last part of IRI)
    Qudt.quantityKindFromLocalName(...): Get QuantityKind by local name (i.e., last part of IRI)
    Qudt.derivedUnitsFrom...(...): Get Units by 'factor units', e.g. find N for factors m, kg, and s^-2. Different matching modes available for broader or narrower matching.
    Qudt.unitFromLabel(...): Get Unit by label

## Acknowledgments

This project has been developed at the [Research Studio Smart Application Technologies](https://sat.researchstudio.at) in the project ‘BIM-Interoperables Merkmalservice’, funded by the
Austrian Research Promotion Agency and Österreichische Bautechnik Veranstaltungs GmbH.

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