npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

convertis

v0.2.1

Published

Convertis is a NodeJS module that lets you convert 'anything'.

Downloads

21

Readme

JavaScript Style Guide

Convertis

Intro

Convertis is a NodeJS module that let's you convert 'anything'. Never write your own convert functions again! Here you will get some convert functions like:

  • Temperature (Celsius, Fahrenheit, Kelvin)
  • Weight (Grams, Kilograms, Tons, Pounds, Ounces)
  • Measurement (Millimeters, Centimeters, Meters, Kilometers, Inches, Feets, Yards, Miles)
  • DataSize (Bytes, Kilobytes, Megabytes, Terabytes, Petabytes, Exabytes, Zetabytes, Yottabytes)
  • Time (Milliseconds, Seconds, Minutes, Hours)
  • Volume (Millilitre, Centilitre, Decilitre, Litre)

More information in the wiki on github.

See the change log for update news.

Install

npm install convertis

Usage

var Convertis = require("convertis");                   //Import the module.
var c = new Convertis();                                //Create an instance of Convertis

//temperature examples
console.log(c.degree(10,"Kelvin","c"));                 //returns 10 kelvin in celsius: -263.15
console.log(c.degree(1,"C","K"));                       //returns 1 celsius in kelvin: 274.15
console.log(c.degree(10,"fahrenheit","c"));             //returns 10 fahrenheit in celsius -12.222222222222221

//weight example
console.log(c.weight(10000,"g","kilograms"));           //returns 10000 grams in kilograms: 10
console.log(c.weight(10000,"grams","oz"));              //returns 10000 grams in ounces: 352.7396195
console.log(c.weight(10000,"tons","g"));                //returns 10000 tons in grams: 10000000000
console.log(c.weight(10000,"pounds","kg"));             //returns 10000 pounds in kilograms: 4535.9237

//measurement example
console.log(c.measurement(100, "millimeters", "cm"));   //return 100 millimeters in centimeters: 10
console.log(c.measurement(100, "m", "miles"));          //return 100 meters in miles: 0.0621371192
console.log(c.measurement(100, "inches", "ft"));        //return 100 inches in feets: 8.33333333

//data size example
console.log(c.dataSize(1, "b", "kb"));                  //returns 1 bytes in kilobytes: 0.0009765625
console.log(c.dataSize(1, "kilobytes", "b"));           //returns 1 kilobytes in bytes: 1024
console.log(c.dataSize(1, "gb", "megabytes"));          //returns 1 gigabytes in megabytes: 1024
console.log(c.dataSize(1, "yottabytes", "tb"));         //returns 1 yottabytes in terabytes: 1099511627776

//time example
console.log(c.time(3, "h", "minutes"));                 //returns 3 hours in minutes: 180
console.log(c.time(3, "m", "ms"));                      //returns 3 minutes in milliseconds: 180000
console.log(c.time(3, "milliseconds", "seconds"));      //returns 3 milliseconds in seconds: 0.003

//Volume example
console.log(c.volume(10, "cl", "ml"));                  //returns 10 Centilitre in Millilitre: 100
console.log(c.volume(10, "Litre", "cl"));               //returns 10 Litre in Centilitre: 1000
console.log(c.volume(10, "decilitre", "litre"));        //returns 10 Decilitre in Litre: 1

Testing

If you want to try some functions before using this module in your application you can use the test.js file located in the root folder of the module and then run the file in your terminal with the command node ./test.js or run npm test from the module folder.

License

ISC - © Copyright Mikael Luxwarp Carlsson

Note/Contribute

Feel free to contribute the way you want.