Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

metric-cnv

0.0.3 • Public • Published

📏🌡️ MetricCnv

metric conversion utility.

badgen badgen

Demo

Usage

$ npm install metric-cnv --save
 
import { kgToLbs, lbsToKg } from 'metric-cnv'
// or
var { kgToLbs, lbsToKg } = require('metric-cnv')
Or include it via jsDelivr CDN:
 
<script src="https://cdn.jsdelivr.net/npm/metric-cnv@0.0.3/build/index.min.js"></script>
metriccnv.kgToLbs(1) // 2

Methods & Examples

Mass

  • kgToLbs(Number, [precision]) : String
    Kilograms to Pounds (kg to lbs)
kgToLbs(1) // 2
kgToLbs(1, 2) // 2.20
kgToLbs(1, 4) // 2.2046
  • lbsToKg(Number, [precision]) : String
    Pounds to Kilograms (lbs to kg)
lbsToKg(1) // 0
lbsToKg(1, 2) // 0.45
lbsToKg(1, 4) // 0.4536

Temperature

  • fahrenheitToCelsius(Number, [precision]) : String
fahrenheitToCelsius(71) // 22
fahrenheitToCelsius(71, 2) // 21.67
  • celsiusToFahrenheit(Number, [precision]) : String
celsiusToFahrenheit(22) // 72
celsiusToFahrenheit(22, 2) // 71.60

Speed

  • kmToMile(Number, [precision]) : String
kmToMile(100) // 62
kmToMile(100, 2) // 62.14
  • mileToKm(Number, [precision]) : String
mileToKm(100) // 161
mileToKm(100, 2) // 160.93

Notes

  • Works both in Node.js and in the browser.
  • All pull requests are welcome, feel free 😊.

License

MIT

Install

npm i metric-cnv

DownloadsWeekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

5.21 kB

Total Files

4

Last publish

Collaborators

  • avatar