All Projects → nosferatoy → Units Converter

nosferatoy / Units Converter

Licence: mit
A simple utility library to measure and convert between units

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Units Converter

Unitsnet
Makes life working with units of measurement just a little bit better.
Stars: ✭ 641 (+1967.74%)
Mutual labels:  units, conversion
cpc
Text calculator with support for units and conversion
Stars: ✭ 89 (+187.1%)
Mutual labels:  conversion, units
Dimensioned
Compile-time dimensional analysis for various unit systems using Rust's type system.
Stars: ✭ 235 (+658.06%)
Mutual labels:  units, conversion
fp-units
An FP-oriented library to easily convert CSS units.
Stars: ✭ 18 (-41.94%)
Mutual labels:  conversion, units
php-unit-conversion
A library providing full PSR-4 compatible unit conversions
Stars: ✭ 47 (+51.61%)
Mutual labels:  conversion, units
Js Quantities
JavaScript library for quantity calculation and unit conversion
Stars: ✭ 335 (+980.65%)
Mutual labels:  units, conversion
Rink Rs
Unit conversion tool and library written in rust
Stars: ✭ 242 (+680.65%)
Mutual labels:  units, conversion
convert
The smallest & fastest library for really easy, totally type-safe unit conversions in TypeScript & JavaScript.
Stars: ✭ 47 (+51.61%)
Mutual labels:  commonjs, conversion
physikal
Mirror of Gitlab Repository
Stars: ✭ 33 (+6.45%)
Mutual labels:  conversion, units
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (+841.94%)
Mutual labels:  units, conversion
Convert Units
An elegant way to convert quantities between different units.
Stars: ✭ 480 (+1448.39%)
Mutual labels:  units, conversion
Alfred Convert
Convert between different units in Alfred
Stars: ✭ 560 (+1706.45%)
Mutual labels:  conversion
Simple Java Mail
Simple API, Complex Emails (JavaMail smtp wrapper)
Stars: ✭ 821 (+2548.39%)
Mutual labels:  conversion
Csprojtovs2017
Tooling for converting pre 2017 project to the new Visual Studio 2017 format.
Stars: ✭ 876 (+2725.81%)
Mutual labels:  conversion
Esbuild
An extremely fast JavaScript and CSS bundler and minifier
Stars: ✭ 29,374 (+94654.84%)
Mutual labels:  commonjs
Metapensiero.pj
Javascript for refined palates: a Python 3 to ES6 Javascript translator
Stars: ✭ 752 (+2325.81%)
Mutual labels:  conversion
Madge
Create graphs from your CommonJS, AMD or ES6 module dependencies
Stars: ✭ 5,635 (+18077.42%)
Mutual labels:  commonjs
Oas Kit
Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
Stars: ✭ 516 (+1564.52%)
Mutual labels:  conversion
Altium2kicad
Altium to KiCad converter for PCB and schematics
Stars: ✭ 490 (+1480.65%)
Mutual labels:  conversion
Bib Rdf Pipeline
Scripts and configuration for converting MARC bibliographic records into RDF
Stars: ✭ 27 (-12.9%)
Mutual labels:  conversion

Units Converter

A simple library to convert units. Heavily based on convert-units.

CircleCI Codacy Badge Codacy Badge

An example implementation of the library.

Key Features

  • Tree shakable.
  • No dependencies.
  • Build for es6, cmj and umd.
  • Tested to 4 significant figures.

Installation

npm install units-converter --save

Usage

The library provide a simple chained API to transform units of the same type. The units are broken down to modules, so it is possible and recommended, to load only the unite types that you are using.

import { voltage } from 'units-converter';

voltage(1).from('V').to('mV').value;
//1000

or

import * as converter from 'units-converter';

converter.voltage(1).from('V').to('mV').value;
//1000

converter.mass(1).from('lb').to('oz').value;
//16
  • Convert unit will return an object of the unit specifed in the "to" function
import { length } from 'units-converter';

length(1200).from('mm').to('m');
 /* {
      value: 1.2,
      unit: 'm',
      system: 'metric',
      singular: 'Meter',
      plural: 'Meters'
    } */
  • Convert unit to Best
import { length } from 'units-converter';

// the smallest unit with a value above 1
length(12000).from('mm').toBest();
/* {  
      value: 1.2,
      unit: 'm',
      system: 'metric',
      singular: 'Meter',
      plural: 'Meters'
    } */

// the smallest unit excluding meters
length(12000).from('mm').toBest({ exclude: ['m'] });
 /* {
      value: 1200,
      unit: 'cm',
      system: 'metric',
      singular: 'Centimeter',
      plural: 'Centimeters'
    } */

// the smallest unit with a value equal to or above 10
length(900).from('mm').toBest({ cutOffNumber: 10 });
 /* {
      value: 90,
      unit: 'cm',
      system: 'metric',
      singular: 'Centimeter',
      plural: 'Centimeters'
    } */
    
// the smallest unit with a value equal to or above 10
length(1000).from('mm').toBest({ cutOffNumber: 10 });
 /* {
      value: 100,
      unit: 'cm',
      system: 'metric',
      singular: 'Centimeter',
      plural: 'Centimeters'
    } */
  • Possibilities will return an array with the abbreviations of the available units
import { voltage } from 'units-converter';

voltage().from('V').possibilities();
// [ 'V', 'mV', 'kV' ]
  • Describe will return an object with all the details of the unit
import { voltage } from 'units-converter';

voltage().describe('V');

/* { 
      unit: 'V', 
      system: 'metric', 
      singular: 'Volt', 
      plural: 'Volts' 
    } */
  • List will return and array with the description of all the available units
import { voltage } from 'units-converter';

voltage().list();

/* [
    { 
      unit: 'V', 
      system: 'metric', 
      singular: 'Volt', 
      plural: 'Volts' 
    },
    {
      unit: 'mV',
      system: 'metric',
      singular: 'Millivolt',
      plural: 'Millivolts'
    },
    {
      unit: 'kV',
      system: 'metric',
      singular: 'Kilovolt',
      plural: 'Kilovolts'
    }
  ] */

Units

Length

  • mm
  • cm
  • m
  • in
  • ft-us
  • ft
  • fathom
  • mi
  • nMi
Area

  • mm2
  • cm2
  • m2
  • ha
  • km2
  • in2
  • ft2
  • ac
  • mi2
Mass

  • mcg
  • mg
  • g
  • kg
  • oz
  • lb
  • mt
  • t
Volume

  • mm3
  • cm3
  • ml
  • l
  • kl
  • m3
  • km3
  • tsp
  • Tbs
  • in3
  • fl-oz
  • cup
  • pnt
  • qt
  • gal
  • ft3
  • yd3
Volume Flow Rate

  • mm3/s
  • cm3/s
  • ml/s
  • cl/s
  • dl/s
  • l/s
  • l/min
  • l/h
  • kl/s
  • kl/min
  • kl/h
  • m3/s
  • m3/min
  • m3/h
  • km3/s
  • tsp/s
  • Tbs/s
  • in3/s
  • in3/min
  • in3/h
  • fl-oz/s
  • fl-oz/min
  • fl-oz/h
  • cup/s
  • pnt/s
  • pnt/min
  • pnt/h
  • qt/s
  • gal/s
  • gal/min
  • gal/h
  • ft3/s
  • ft3/min
  • ft3/h
  • yd3/s
  • yd3/min
  • yd3/h'
Temperature

  • C
  • F
  • K
  • R
Time

  • ns
  • mu
  • ms
  • s
  • min
  • h
  • d
  • week
  • month
  • year
Frequency

  • Hz
  • mHz
  • kHz
  • MHz
  • GHz
  • THz
  • rpm
  • deg/s
  • rad/s
Speed

  • m/s
  • km/h
  • m/h
  • knot
  • ft/s
Pace

  • s/m
  • min/km
  • s/ft
  • min/km
Pressure

  • Pa
  • hPa
  • kPa
  • MPa
  • bar
  • torr
  • psi
  • ksi
Digital

  • b
  • Kb
  • Mb
  • Gb
  • Tb
  • B
  • KB
  • MB
  • GB
  • TB
Illuminance

  • lx
  • ft-cd
Parts-Per

  • ppm
  • ppb
  • ppt
  • ppq
Voltage

  • V
  • mV
  • kV
Current

  • A
  • mA
  • kA
Power

  • W
  • mW
  • kW
  • MW
  • GW
Apparent Power

  • VA
  • mVA
  • kVA
  • MVA
  • GVA
Reactive Power

  • VAR
  • mVAR
  • kVAR
  • MVAR
  • GVAR
Energy

  • Wh
  • mWh
  • kWh
  • MWh
  • GWh
  • J
  • kJ
Reactive Energy

  • VARh
  • mVARh
  • kVARh
  • MVARh
  • GVARh
Angle

  • deg
  • rad
  • grad
  • arcmin
  • arcsec
Charge

  • c
  • mC
  • μC
  • nC
  • pC
Force

  • N
  • kN
  • lbf
Acceleration

  • g (g-force)
  • m/s2

Road map

  • Add types to support better integration with typescript using projects.

  • Add functionality for the addition of custom units.

  • Add more units, the goal is to approach the amount of units provided by matlab.

  • Rewrite the project with typescript.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].