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

math-essential

v0.0.1

Published

A lightweight JavaScript math utilities library for basic mathematical operations

Readme

🧮 math-essential

The JavaScript math library you've been waiting for.

npm version Downloads License: MIT

Simple, fast, and powerful mathematical utilities for JavaScript developers. Zero dependencies, TypeScript ready.

✨ Why math-essential?

  • 🚀 Blazing Fast - Optimized for performance
  • 🪶 Lightweight - Zero dependencies, minimal bundle size
  • 🎯 TypeScript Ready - Full type definitions included
  • 🧪 Well Tested - 100% test coverage
  • 📚 Comprehensive - Everything you need for math operations
  • 🔧 Tree Shakeable - Import only what you need

🚀 Quick Start

npm install math-essential
const { sum, mean, isPrime } = require('math-essential');

// Basic arithmetic
sum(1, 2, 3, 4, 5);        // 15

// Statistics
mean([1, 2, 3, 4, 5]);     // 3

// Number theory
isPrime(17);               // true

That's it! You're ready to crunch numbers like a pro.

🎯 Features

🧮 Basic Math

const { sum, multiply, power, round } = require('math-essential');

sum(1, 2, 3, 4);              // 10
multiply(2, 3, 4);            // 24
power(2, 8);                  // 256
round(3.14159, 2);            // 3.14

📊 Statistics

const { mean, median, mode, standardDeviation } = require('math-essential');

const data = [1, 2, 2, 3, 4, 4, 4, 5];

mean(data);                   // 3.125
median(data);                 // 3.5
mode(data);                   // [4]
standardDeviation(data);      // 1.356

📐 Geometry

const { circleArea, distance, triangleArea } = require('math-essential');

circleArea(5);                // 78.54
distance(0, 0, 3, 4);         // 5
triangleArea(10, 8);          // 40

🔢 Number Theory

const { isPrime, factorial, gcd, fibonacci } = require('math-essential');

isPrime(17);                  // true
factorial(5);                 // 120
gcd(48, 18);                  // 6
fibonacci(10);                // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

🔄 Unit Conversion

const { degreesToRadians, celsiusToFahrenheit } = require('math-essential');

degreesToRadians(90);         // 1.5708
celsiusToFahrenheit(25);      // 77

💡 Real-world Examples

Calculate compound interest

const { power, round } = require('math-essential');

function compoundInterest(principal, rate, time) {
  return round(principal * power(1 + rate/100, time), 2);
}

compoundInterest(1000, 5, 10); // 1628.89

Analyze test scores

const { mean, median, standardDeviation } = require('math-essential');

const scores = [85, 92, 78, 96, 88, 91, 87, 93];

console.log(`Average: ${mean(scores)}`);           // 88.75
console.log(`Median: ${median(scores)}`);          // 89.5
console.log(`Std Dev: ${standardDeviation(scores)}`); // 5.77

Generate Fibonacci sequence for UI animations

const { fibonacci } = require('math-essential');

const delays = fibonacci(8).map(n => n * 100);
// [0, 100, 100, 200, 300, 500, 800, 1300] ms delays

🎨 Tree Shaking Support

Import only what you need:

// ESM
import { sum, mean } from 'math-essential';

// CommonJS
const { sum, mean } = require('math-essential');

// Webpack will automatically tree-shake unused functions

📚 Full API Reference

Basic Math

  • sum(...numbers) - Add multiple numbers
  • multiply(...numbers) - Multiply multiple numbers
  • power(base, exponent) - Calculate power
  • round(number, decimals) - Round to decimal places
  • abs(number) - Absolute value

Statistics

  • mean(array) - Calculate average
  • median(array) - Find median value
  • mode(array) - Find most frequent value(s)
  • standardDeviation(array) - Calculate standard deviation
  • minMax(array) - Find min and max values

Geometry

  • circleArea(radius) - Circle area
  • rectangleArea(length, width) - Rectangle area
  • triangleArea(base, height) - Triangle area
  • distance(x1, y1, x2, y2) - Distance between points
  • sphereVolume(radius) - Sphere volume

Number Theory

  • isPrime(number) - Check if prime
  • factorial(number) - Calculate factorial
  • gcd(a, b) - Greatest common divisor
  • lcm(a, b) - Least common multiple
  • fibonacci(n) - Generate Fibonacci sequence

Converters

  • degreesToRadians(degrees) - Convert degrees to radians
  • radiansToDegrees(radians) - Convert radians to degrees
  • celsiusToFahrenheit(celsius) - Temperature conversion
  • fahrenheitToCelsius(fahrenheit) - Temperature conversion

🤝 Contributing

We love contributions! Please read our Contributing Guide to get started.

📄 License

MIT

🌟 Support

If you found this library helpful, please consider:

  • ⭐ Starring the repo
  • 🐛 Reporting bugs
  • 💡 Suggesting new features
  • 🔀 Contributing code

Made with ❤️ for the JavaScript community

Stop reinventing the wheel. Start building amazing things.