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 🙏

© 2025 – Pkg Stats / Ryan Hefner

numba

v0.0.2

Published

Some number functions

Downloads

18

Readme

Numba

Numba is a class that provides a simple and convenient way to perform various mathematical operations on numbers. The class is designed to be used in chains, allowing for easy and concise mathematical expressions.

Installation

To install Numba, run the following command in your terminal:

npm install numba

API

  • pow(x: number): Returns the power of the number.
  • powNorm(x: num, ceiling: num): Returns the power of the number, normalized to 0..1.
  • powSign(x: num): Returns the sign of the power of the number.
  • abs: Returns the absolute value of the number.
  • sign: Returns the sign of the number.
  • log(base = Math.E): Returns the logarithm of the number.
  • sin: Returns the sine of the number.
  • cos: Returns the cosine of the number.
  • hyperSin: Returns the hyperbolic sine of the number.
  • aHyperSin: Returns the inverse hyperbolic sine of the number.
  • floor: Returns the floor of the number.
  • floorLeftover: Returns the floor leftover of the number.
  • ceil: Returns the ceiling of the number.
  • round: Returns the rounded value of the number.
  • rough(precision = 3): Returns the rough value of the number.
  • add(x: num): Returns the sum of the number and x.
  • sub(x: num): Returns the difference between the number and x.
  • mul(x: num): Returns the product of the number and x.
  • div(x: num): Returns the division between the number and x.
  • freq2bark: Converts frequency to bark.
  • bark2freq: Converts bark to frequency.
  • note2freq: Converts note to frequency.
  • freq2note: Converts frequency to note.
  • magnitudeSq(other: num): Returns the magnitude squared of the number and other.
  • magnitude(other: num): Returns the magnitude of the number and other.
  • exp: Returns the exponential of the number.
  • mix(a: num, b: num): Returns a mix of a and b with the number as a factor.
  • clamp(a: num, b: num): Returns the number clamped between a and b.
  • unMix(a: num, b: num): Returns the un-mixed value of the number.
  • remix(fromStart: num, fromEnd: num, toStart: num, toEnd: num): Returns the remixed value of the number.
  • isInteger: Returns whether the number is an integer.
  • isPowOf2: Returns whether the number is a power of 2.
  • powOf2Above: Returns the nearest power of 2 above the number.
  • powOf2Below: Returns the nearest power of 2 below the number.
  • toFixedExp(digits = 2): Returns the number in fixed exponential form.

Usage

To use Numba, simply import the class into your project and start chaining mathematical operations:

// do this only once in the entire project:
Numba.includeMe();


// now you can use Numba in your code, with nice chaining:

const result = num
  .pow(2)
  .round()
  .toFixedExp();

console.log(result); // 100