Skip to main content

qtty-js

Active

JavaScript and WebAssembly bindings for qtty, for units and conversions in Node and the browser.

0 stars
0 forks
JavaScript
AGPL-3.0
Updated 2 months ago

Why it exists

qtty-js brings the qtty unit model to JavaScript without changing how the conversions work. You get matching Node and browser packages with a straightforward JS and TypeScript API.

Key Features

  • Node package: @siderust/qtty
  • Browser/WASM package: @siderust/qtty-web
  • Typed Quantity and DerivedQuantity APIs
  • Unit factories and TypeScript declarations
  • Shared conversion semantics from vendored qtty

Getting Started

npm install @siderust/qtty

const { Quantity, Unit, convert } = require('@siderust/qtty');

const distance = new Quantity(1500, Unit.Meter);
console.log(distance.to(Unit.Kilometer).value);
console.log(convert(2, Unit.Hour, Unit.Minute));

Contributing

We welcome contributions! Here's how you can help:

  • 1 Fork the repository and create your branch from main
  • 2 Make your changes and add tests if applicable
  • 3 Ensure all tests pass with cargo test
  • 4 Submit a pull request with a clear description

License

This project is licensed under the AGPL-3.0 license. See the LICENSE file for details.

Tags

javascript wasm node browser units bindings