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

react-basic-maths

v1.0.6

Published

A TypeScript utility library providing essential mathematical operations and functions for developers. It includes basic arithmetic operations, statistical calculations, combinatorics, rounding functions, and more. Perfect for JavaScript and TypeScript pr

Readme

react-basic-maths

npm version Build Status License

A simple math utility library for basic and advanced math operations built with TypeScript.

Features

  • sum, sub, multi, div for basic arithmetic operations
  • abs, max, min, average for common math functions
  • permutation, combination for advanced combinatorics
  • round, floor, ceil for rounding operations
  • pow, sqrt, cbrt, log for power and logarithmic operations
  • fibonacci for generating Fibonacci numbers

Upcoming: Trigonometry, Statistics, and Geometry calculations will be added in upcoming versions.

Installation

npm install react-basic-maths

Usage

import math from 'react-basic-maths';

math.sum(1, 2, 3); // 6
math.sub(10, 5, 2); // 3
math.multi(2, 3, 4); // 24
math.div(100, 2, 5); // 10

math.abs(-20); // 20
math.max(1, 2, 3); // 3
math.min([5, 1, 6]); // 1
math.average(2, 4, 6); // 4

math.permutation(5, 2); // 20
math.combination(5, 2); // 10

math.round(4.6); // 5
math.floor(4.6); // 4
math.ceil(4.1); // 5

math.pow(2, 3); // 8
math.sqrt(9); // 3
math.cbrt(27); // 3
math.log(100, 10); // 2

math.fibonacci(7); // [0, 1, 1, 2, 3, 5, 8]

API

Basic Arithmetic

  • sum(...numbers: number[])
  • sub(...numbers: number[])
  • multi(...numbers: number[])
  • div(...numbers: number[])

Advanced Math

  • permutation(n: number, r: number)
  • combination(n: number, r: number)

Utility Math

  • abs(num: number)
  • max(...args: number[] | [number[]])
  • min(...args: number[] | [number[]])
  • average(...args: number[] | [number[]])

Rounding

  • round(num: number)
  • floor(num: number)
  • ceil(num: number)

Power and Roots

  • pow(base: number, exponent: number)
  • sqrt(num: number)
  • cbrt(num: number)

Logarithmic

  • log(num: number, base: number = 10)

Sequences

  • fibonacci(n: number)

License

MIT

Contributing

Feel free to open issues or submit pull requests to improve the library or suggest new features.