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

cal-sum-avg-mode-medium-range-and-more

v1.0.5

Published

Now, you can calculate the sum, average, mode, median, range, variance, and standard deviation for the given array of numbers.

Downloads

5

Readme

cal-sum-avg-mode-medium-range-and-more

Now, you can calculate the sum, average, mode, median, range, variance, and standard deviation for the given array of numbers:

Install

npm i cal-sum-avg-mode-medium-range-and-more

Usage

functionName(array);

array - input array.

Invoke:

const {
  sum,
  avg,
  mode,
  median,
  range,
  variance,
  standardDeviation,
} = require("cal-sum-avg-mode-medium-range-and-more");

Input:

input must be an array of numbers.

const arr = [48, 35, 2, 56, 7, 23, 70, 5, 58, 58, 5, 5];

Sum:

The sum of a set of numbers is the result of adding all the numbers together.

const getSum = sum(arr);

Output:

372; // number

Average (Mean):

The average, or mean, of a set of numbers is calculated by adding all the numbers together and then dividing the sum by the total count of numbers.

const getAvg = avg(arr);

Output:

31; // number

Mode:

The mode of a set of numbers is the number that appears most frequently in the set. A set of numbers can have one mode, more than one mode (multi-modal), or no mode at all.

const getMode = mode(arr);

Output:

[5]; // array

Median:

The median of a set of numbers is the middle value when the numbers are arranged in ascending order. If there is an even number of values, the median is the average of the two middle values.

const getMedian = median(arr);

Output:

29; // number

Range:

The range of a set of numbers is the difference between the maximum (largest) and minimum (smallest) values in the set. It measures the spread or dispersion of the data.

const getRange = range(arr);

Output:

68; // number

Variance:

Variance is a measure of how much the values in a dataset differ from the mean. It is calculated by taking the average of the squared differences between each value and the mean.

const getVariance = variance(arr);

Output:

618.1666666666666; // number

Standard deviation:

The standard deviation is a statistic that quantifies the amount of variation or dispersion in a set of values. It is the square root of the variance and provides a measure of how spread out the values are in relation to the mean.

const getStandardDeviation = standardDeviation(arr);

Output:

24.862957721612016; // number

License

ISC © chamaramadhushanka