@keithalpichi/unitconverter
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Unitconverter

NPM Version

Package Size

License

Stars

Unitconverter is a library to convert units of measurements such as length, mass, volume, and more.

If you need to convert inches to centimeters, centimeters to feet, kilograms to pounds, liters to quarts, or perform any other conversions then Unitconverter is the library for you.

It is written in Typescript, compiled to Javascript, and thoroughly tested with Jest.

Table of Contents

  1. Installation
  2. Usage
  3. Documentation
  4. Develop
  5. Contributing
  6. RoadMap
  7. Changelog
  8. License

Installation

npm i @keithalpichi/unitconverter

Usage

Simply import the type of converter you'd like to use. In this case we'll showcase the LengthConverter:

const { LengthConverter } from "@keithalpichi/unitconverter"

Initialize an instance:

const item = new LengthConverter({ unit: "ft", value: 2 });

Use the add method to add to the converter value:

item.add(1); // value is now at 3

Use the to method to convert the unit to another unit:

item.to("in");

Use the value method to return the converted value

item.value(); // 36

Additionally, you can chain the methods together:

const value = item.add(1).to("in").value();

Documentation

Refer to the Documentation Guide

Develop

If you're interested in contributing please read the Contributing Guide

  • Fork this repo
  • Install dependencies with npm i
  • Create tests for your changes
  • Make your changes
  • Test your changes with npm run test (there is also a git pre-commit hook that runs this script if you forget to)

Contributing

Refer to the Contributing Guide

Roadmap

  • Add MassConverter
  • Add VolumeConverter

View the Issue Tracker for more details.

Changelog

Refer to the Changelog Document

License

Unitconverter is MIT licensed

Package Sidebar

Install

npm i @keithalpichi/unitconverter

Weekly Downloads

1

Version

1.3.0

License

MIT

Unpacked Size

12.9 kB

Total Files

10

Last publish

Collaborators

  • keithalpichi