Licence
MIT
Version
0.1.0
Deps
0
Size
11 kB
Vulns
0
Weekly
0
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
| Name | Label |
|---|---|
| Millimeter | mm |
| Centimeter | cm |
| Meter | m |
| Kilometer | km |
| Inch | in |
| Foot | ft |
| Yard | yd |
| Mile | mi |
Area
| Name | Label |
|---|---|
| Square Meter | sqm |
| Square Foot | sqft |
| Tsubo | tsubo |
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