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 🙏

© 2026 – Pkg Stats / Ryan Hefner

anmatlib

v1.0.2

Published

Javascript math library

Downloads

3

Readme

npm GitHub package.json version GitHub repo size GitHub last commit GitHub top language GitHub issues npm collaborators GitHub followers GitHub watchersCoverage Statusnpm

anmatlib

A Javascript math library

How to use:

goldenRatio

Returns the goldenRatio property of Number

const x = 5 x.goldenRatio // 1.61803398875

round()

Rounds a number

const x = 5.9 x.round() // 6

round()

Rounds down a number

const x = 5.9 x.floor() // 5

ceil()

Rounds up a number

const x = 1.03 x.ceil() // 2

pad(x, y)

Pads a number with x 0s before '.' and y 0s after '.'

`const x = 34.801 x.pad(4,4) // 0034.8010

const y = 34.801 y.pad(4,3) // 0034.801 `

degToRad()

Takes a number and returns the results of this formula: deg * (Math.PI / 180)

`const x = 45 x.degToRad() // 0.785

const y = "a" y.degToRad() // TypeError `

radToDeg()

Covert radians to degrees from this formula: radians * (180/pi)

`const x = 0.785 x.radToDeg() // 44.977

const y = "a" y.degToRad() // TypeError `

toDollars()

Take a numeric value and return a string beginning with a '$' and rounded to two decimal places

`const x = 34.801 x.toDollars() // $34.80;

const y = 2 y.toDollars(4,3) // $2.00 `

tax(n)

Returns the tax amount

const x = 32.01 x.tax(0.56) // 32.57

interest(total, year, rate)

Calculates the interest over time

Number.interest(100, 1, 1) // 101

mortage(principal, numberOfPayments, interestRate)

Calculates mortage: M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]

Number.mortage(100000, 30, 3.92) // 392000

intToHex()

Converts int to hex

const x = 20 x.intToHex() // 14

random(n)

Returns an integer from 0 to n - 1

const x = Number.random(5) x < 5 // true

randomRange(min, max)

Returns an integer from min to max

const x = Number.randomRange(2, 5) x < 5 // true x > 2 // true

randomColor(n)

Returns a random hex color

const a = Number.randomColor() // returns a random color in hex

Test coverage

npx jest --coverage PASS ./test.js ✓ goldenRatio (4ms) ✓ round (1ms) ✓ floor ✓ ceil ✓ pad (1ms) ✓ degToRad (3ms) ✓ radToDeg (1ms) ✓ toDollars ✓ tax (1ms) ✓ interest ✓ mortage ✓ intToHex (1ms) ✓ random functions (9ms)

console.log test.js:76 62d839

----------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ----------|----------|----------|----------|----------|-------------------| All files | 90.48 | 50 | 100 | 90.48 | | index.js | 90.48 | 50 | 100 | 90.48 | 36,37,46,47 | ----------|----------|----------|----------|----------|-------------------| Test Suites: 1 passed, 1 total Tests: 13 passed, 13 total Snapshots: 0 total Time: 2.103s Ran all test suites.