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

@iggijimenez/math-lib

v1.0.1

Published

Challenge 1 GoldenRatio - Add a new property to Number that is the Golden Ratio

Downloads

2

Readme

Math Library

JavaScript Libraries

Installation


GoldenRatio()

Add a new property to Number that is the Golden Ratio

 capitalize("macbook");  
  // returns "Macbook"

Number Methods


round()

rounds to the nearest whole number

9.50.round();    
  // returns 10

floor()

goes to the nearest lowest whole number

9.50.floor()
  // returns 9

ceil()

returns the highest nearest whole number

9.4.ceil() 
  // returns 10

pad()

returns pads Number with x 0s before, and y 0s after

1.1.pad(4, 4);  
  // returns 0001.1000

degToRad()

returns a convertion from degrees to radians

degToRad(45);  
  // returns 0.785

radToDeg()

Coverts radians to degrees.

readToDeg(0.785);  
  // returns 44.977

toDollars()

returns input formatting money is a common task for software projects. A function could save you time in the future. The goal of this function is to take a numeric value and return a string beginning with a '$' and rounded to two decimal places

toDollars(10);  
  // returns $10.00

tax(rate)

Returns the tax amount

tax(10);  
  // returns 10.10

interest(total, year, rate)

returns the calculation with the interest over time

interest(10, 10, 8)
  // returns 21.58

mortage(principal, numberOfPayments, interestRate))

returns the calculation of a mortage

mortage(10, 10, 8)
  // returns 100.00000046650739