npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@breadstone/ziegel-intl-units

v0.0.9

Published

Contains classes of the Unit Conversion library that are essential for the conversion between different units of measurement.

Readme

@breadstone/ziegel-intl-units

MIT License TypeScript npm

Comprehensive units of measurement and quantity system for the ziegel framework. Provides strongly-typed quantities, unit conversions, and internationalized formatting for physical measurements.

Units & Measurements: Complete measurement system with type-safe quantities, unit conversion, and culture-aware formatting for scientific and engineering applications.

🚀 Overview

@breadstone/ziegel-intl-units provides:

  • Quantity System: Strongly-typed quantities for Length, Mass, Area, Volume, Energy measurements
  • Unit Conversion: Seamless conversion between metric, imperial, and custom unit systems
  • Internationalized Formatting: Culture-aware display and formatting of measurements
  • Type Safety: Full TypeScript support with interfaces and type guards
  • Multiple Unit Systems: Support for metric, imperial, and custom measurement systems
  • Extensible Architecture: Easy to add new units, quantities, and measurement types

📦 Installation

npm install @breadstone/ziegel-intl-units
# or
yarn add @breadstone/ziegel-intl-units

🧩 Features & Usage Examples

Length Quantities

import { LengthQuantity, LengthUnit, ILengthQuantity } from '@breadstone/ziegel-intl-units';

// Create and convert length measurements
const meters = new LengthQuantity(100, LengthUnit.Meter);
const feet = meters.convertTo(LengthUnit.Foot);
const inches = meters.convertTo(LengthUnit.Inch);

console.log(`${meters.value} m = ${feet.value} ft = ${inches.value} in`);

// Type checking with interfaces
function processLength(length: ILengthQuantity) {
  return length.convertTo(LengthUnit.Centimeter);
}

Mass and Weight

import { MassQuantity, MassUnit, IMassQuantity } from '@breadstone/ziegel-intl-units';

const kilograms = new MassQuantity(75, MassUnit.Kilogram);
const pounds = kilograms.convertTo(MassUnit.Pound);
const stones = kilograms.convertTo(MassUnit.Stone);

console.log(`${kilograms.value} kg = ${pounds.value} lbs = ${stones.value} st`);

// Type guards for validation
import { isMassQuantity } from '@breadstone/ziegel-intl-units';
if (isMassQuantity(someValue)) {
  // TypeScript knows someValue is IMassQuantity
  const grams = someValue.convertTo(MassUnit.Gram);
}

Area Measurements

import { AreaQuantity, AreaUnit, IAreaQuantity } from '@breadstone/ziegel-intl-units';

const squareMeters = new AreaQuantity(100, AreaUnit.SquareMeter);
const squareFeet = squareMeters.convertTo(AreaUnit.SquareFoot);
const acres = squareMeters.convertTo(AreaUnit.Acre);

console.log(`${squareMeters.value} m² = ${squareFeet.value} ft² = ${acres.value} acres`);

Volume and Capacity

import { VolumeQuantity, VolumeUnit, IVolumeQuantity } from '@breadstone/ziegel-intl-units';

const liters = new VolumeQuantity(50, VolumeUnit.Liter);
const gallons = liters.convertTo(VolumeUnit.Gallon);
const cubicFeet = liters.convertTo(VolumeUnit.CubicFoot);

console.log(`${liters.value} L = ${gallons.value} gal = ${cubicFeet.value} ft³`);

Energy Measurements

import { EnergyQuantity, EnergyUnit, IEnergyQuantity } from '@breadstone/ziegel-intl-units';

const joules = new EnergyQuantity(1000, EnergyUnit.Joule);
const calories = joules.convertTo(EnergyUnit.Calorie);
const kilowattHours = joules.convertTo(EnergyUnit.KilowattHour);

console.log(`${joules.value} J = ${calories.value} cal = ${kilowattHours.value} kWh`);

Internationalized Formatting

import {
  LengthQuantityFormat, MassQuantityFormat, AreaQuantityFormat,
  VolumeQuantityFormat, EnergyQuantityFormat
} from '@breadstone/ziegel-intl-units';

// Format quantities with culture-specific formatting
const lengthFormatter = new LengthQuantityFormat('en-US');
const massFormatter = new MassQuantityFormat('de-DE');

const distance = new LengthQuantity(1500, LengthUnit.Meter);
const weight = new MassQuantity(75, MassUnit.Kilogram);

console.log(lengthFormatter.format(distance, 'short')); // "1500 m"
console.log(lengthFormatter.format(distance, 'long'));  // "1500 meters"
console.log(massFormatter.format(weight, 'long'));      // "75 Kilogramm"

Unit System Management

import { UnitSystem } from '@breadstone/ziegel-intl-units';

// Work with different unit systems
console.log(UnitSystem.Metric);   // For metric system
console.log(UnitSystem.Imperial); // For imperial system
console.log(UnitSystem.US);       // For US customary units

// Determine preferred units based on unit system
function getPreferredLengthUnit(system: UnitSystem) {
  switch (system) {
    case UnitSystem.Metric: return LengthUnit.Meter;
    case UnitSystem.Imperial: return LengthUnit.Foot;
    default: return LengthUnit.Meter;
  }
}

📚 Package import points

import {
    // Formatting
    AreaQuantityFormat, EnergyQuantityFormat, LengthQuantityFormat,
    MassQuantityFormat, VolumeQuantityFormat,

    // Quantities (Base & Implementations)
    QuantityBase,
    AreaQuantity, EnergyQuantity, LengthQuantity, MassQuantity, VolumeQuantity,

    // Quantity Interfaces & Type Guards
    IAreaQuantity, isAreaQuantity,
    IEnergyQuantity, isEnergyQuantity,
    ILengthQuantity, isLengthQuantity,
    IMassQuantity, isMassQuantity,
    IQuantity, isQuantity,
    IVolumeQuantity, isVolumeQuantity,

    // Unit Systems & Units
    UnitSystem,
    AreaUnit, EnergyUnit, LengthUnit, MassUnit, VolumeUnit
} from '@breadstone/ziegel-intl-units';

📚 API Documentation

For detailed API documentation, visit: API Docs

Related Packages

  • @breadstone/ziegel-core: Foundation utilities and type definitions
  • @breadstone/ziegel-intl: Core internationalization support
  • @breadstone/ziegel-intl-commerce: Commerce-specific internationalization

License

MIT

Issues

Please report bugs and feature requests in the Issue Tracker


Part of the ziegel Enterprise TypeScript Framework