Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including awesome-converter with all npm packages installed. Try it out:

const {convert, definitions} = require('awesome-converter'); const {inspect} = require('util'); // Or for babel / typescript: // import { convert, definitions } from 'awesome-querystring'; // import { inspect } from 'util'; ==> Note that this requires @types/node !! // Just pass required arguments // expected output: 0.22046244 console.log(convert(100, 'g', 'lb')); // Specify decimal precision // expected output: 0.22 console.log(convert(100, 'g', 'lb', {precision: 3})); // Will not work if you pass units of different groups // expected error: Cannot convert incompatible unit of g to m console.log(convert(100, 'g', 'm')); // Log all supported definitions console.log(inspect(definitions, {showHidden: false, depth: null}));

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

awesome-converter v1.0.5

Awesome and typesafe unit converter

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free