2.1.0 • Published 8 months ago

@goggles/unit-system v2.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Unit System

This an NPM package containing system for creating and combining units to streamline dimensional analysis and simplify unit conversion.

It is intended to be used with other packages which implement sets of units (such as the SI units, US Customary units, etc.).

It is also more streamlined to use this system in combination with the Number-like system (available at Vjedi729/number-like), using the UnitNumber sample.

Features

  • Convert numbers to and from a "base unit".
  • Create units based on multiplication from other units.
  • Create custom units which can handle units with offset "zero" values (such as Fahrenheit and Celsius) and units which are non-linear (such as pH and decibels).
  • Unit dimension and mathematical properties are available to check if numbers in particular units can be added linearly or if number in one particular unit can be converted into another.
    • Future feature: helper functions for indicating if/when it is "correct" to add/multiply numbers between two units and what the unit of the result will be.

Typescript

  • Compile time checking of unit dimensions and mathematical properties, allowing compile time checking of compatibility. See UnitNumber in Vjedi729/number-like.
    • Future feature: helper template types for indicating if/when it is "correct" to add/multiply numbers between two units and what the unit of the result will be.
  • Compile-time knowledge of names of units, when names are provided to the constructor, allowing referencing via dictionaries with keys and values defined at compile time.
    • WIP feature: helper template types for referencing units via dictionaries.

Pre-built Units

The SI units (basic and derived) are available at https://www.npmjs.com/package/@goggles/unit-system-si-units

Common US Customary units are available at https://www.npmjs.com/package/@goggles/unit-system-common-uscs-units

Units which are a work in progress can be seen at https://github.com/Vjedi729/unit-system-miscellaneous-units. It is not recommended to use this package directly in production code, because units will be removed from this package to create various additional packages for logically grouped sets of units.

2.1.0

8 months ago

2.0.0

10 months ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago