Skip to content

mannershark/da-unit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

da-unit

Da-unit provides statically typed units for Energy, Power and Time, so you will never mix up MW with MWh again.

Installation

npm install da-unit

Example

import { Power, Time } from 'da-unit';

const peakDemand = new Power(100, 'MW');
const averageDemand = peakDemand.div(10);
const yearlyEnergyUse = averageDemand.toEnergy(new Time(1, 'year'));

console.log(yearlyEnergyUse.get('MWh')); // 87600

About

Typescript unit conversions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published