Skip to content

Convert fuel consumption between mpg and l/100km in Node.js

License

Notifications You must be signed in to change notification settings

attila/mpgconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpgconvert

Build Status Coverage Status

Convert fuel consumption between mpg and l/100km in Node.js

The module currently supports conversions between miles per imperial gallon (mpg) and litres per 100 km.

Installation

The project is published to the npm registry, install it via your favourite package manager for node:

npm i mpgconvert

If you wish to use it as a handy tool in your command line, install it globally

npm i -g mpgconvert

Usage

As a module

The module has two separate functions exported for conversions.

const { mpg, l100km } = require('mpgconvert')

mpg(38)
// 7.433711924989639
l100km(7.2)
// 45.561460185420366

Command line

The package installs a command line executable named mpgc.

Usage: mpgc <command> [value]

Commands:
  mpg [value]     Convert fuel consumption from mpg to l/100km      [aliases: m]
  l100km [value]  Convert fuel consumption from l/100km to mpg      [aliases: l]

Options:
  --version   Show version number                                      [boolean]
  -h, --help  Show help                                                [boolean]

Examples:

$ mpgc m 48
5.885021940616797
$ mpgc l 5.85
48.287359512753206

Planned features

  • Conversion to and from in US mpg

About

Convert fuel consumption between mpg and l/100km in Node.js

Resources

License

Stars

Watchers

Forks

Packages