0.1.0 • Published 1 year ago

@benehmke/measurement v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Measurement

Javascript Classes for storing, and converting units of measurement

Installation

npm install @benehmke/measurement
import {Length} from 'measurement';

const boxFront = new Length('9 ft');
const boxSide = new Length(4, 'ft');
const boxHeight = new Length({value: 4, unit: 'in'})

Usage

to(units)

const boxFront = new Length('9 ft');
console.log(boxFront.to('in'));
// >> 108 in

valueOf

const distanceA = new Length('9 ft');
const distanceB = new Length('5 m');
console.log(distanceA < distanceB);
// >> true

Units

Length

NameLabel
Millimetermm
Centimetercm
Meterm
Kilometerkm
Inchin
Footft
Yardyd
Milemi

Area

NameLabel
Square Metersqm
Square Footsqft
Tsubotsubo

Development

TODO

  • Add/Subtract Method
  • Length.toArea
  • Custom Unit rename (ex ft2 for sqft)
  • Volume
  • Weight

Build

npm run build

Test

npm run test

Release

npm publish