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

extra-number.web

v2.4.0

Published

A number is a mathematical object used to count, measure, and label {web}.

Downloads

141

Readme

A number is a mathematical object used to count, measure, and label. 📦 Node.js, 🌐 Web, 📜 Files, 📰 Docs. 📘 Wiki.

In JavaScript, Number type is double-precision 64-bit binary format IEEE 754 value. This package includes common number functions related to querying about numbers, comparing numbers, rounding numbers, performing rounded division, performing modulo operations, controlling range of numbers, performing arithmetic operations, obtaining divisors of a number (and related operations), getting the number of possible arrangements of a set of objects, performing geometry-related calculations, performing basic statistical analysis, and finding various statistical means.

This package is available in Node.js and Web formats. To use it on the web, simply use the extra_number global variable after loading with a <script> tag from the jsDelivr CDN.

Stability: Experimental.

const xnumber = require('extra-number');
// import * as xnumber from "extra-number";
// import * as xnumber from "https://unpkg.com/extra-number/index.mjs"; (deno)

xnumber.isPrime(53);
// → true

xnumber.properDivisors(6);
// → [1, 2, 3]

xnumber.round(9.1357, 0.05);
// → 9.15

xnumber.significantDigits(0.0034);
// → 2

// TOFIX:
// xnumber.fromRoman('DCXLIX');
// → 649

// xnumber.toScientific(695700000);
// → '6.957×10⁸' (radius of Sun in m)

Index

| Property | Description | | ---- | ---- | | is | Check if value is a number. | | significantDigits | Count the number of significant digits in a number. | | | | | compare | Compare two numbers. | | | | | floor | Round down a number to specific precision. | | ceil | Round up a number to specific precision. | | round | Round a number to specific precision. | | | | | floorDiv | Perform floor-divison of two numbers. | | ceilDiv | Perform ceiling-divison of two numbers. | | roundDiv | Perform rounded-divison of two numbers. | | | | | rem | Find the remainder of x/y with sign of x (truncated division). | | mod | Find the remainder of x/y with sign of y (floored division). | | modp | Find the remainder of x/y with +ve sign (euclidean division). | | | | | constrain | Constrain a number within a minimum and a maximum value. | | normalize | Normalize a number from its current range into a value between 0 and 1. | | remap | Re-map a number from one range to another. | | lerp | Linearly interpolate a number between two numbers. | | | | | isPow | Check if a number is a power-of-n. | | prevPow | Find largest power-of-n less than or equal to given number. | | nextPow | Find smallest power-of-n greater than or equal to given number. | | | | | root | Find the nth root of a number (ⁿ√). | | log | Find the logarithm of a number with a given base. | | | | | properDivisors | List all divisors of a number, except itself. | | aliquotSum | Sum all proper divisors of a number. | | minPrimeFactor | Find the least prime number which divides a number. | | maxPrimeFactor | Find the greatest prime number which divides a number. | | primeFactors | Find the prime factors of a number. | | primeExponentials | Find the prime factors and respective exponents of a number. | | isPrime | Check if number is prime. | | gcd | Find the greatest common divisor of numbers. | | lcm | Find the least common multiple of numbers. | | | | | factorial | Find the factorial of a number. | | binomial | Find the number of ways to choose k elements from a set of n elements. | | multinomial | Find the number of ways to put n objects in m bins (n=sum(kᵢ)). | | | | | degrees | Convert radians to degrees. | | radians | Convert degrees to radians. | | | | | sum | Find the sum of numbers (Σ). | | product | Find the product of numbers (∏). | | median | Find the value separating the higher and lower halves of numbers. | | modes | Find the values that appear most often. | | range | Find the smallest and largest values. | | variance | Find the mean of squared deviation of numbers from its mean. | | | | | arithmeticMean | Find the average of numbers. | | geometricMean | Find the geometric mean of numbers. | | harmonicMean | Find the harmonic mean of numbers. | | quadriaticMean | Find the quadriatic mean of numbers. | | cubicMean | Find the cubic mean of numbers. |

References

ORG DOI Coverage Status Test Coverage Maintainability