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

ez-math.js

v1.1.7

Published

A simple package to make doing mathematical operations very easy!

Downloads

2

Readme

easy-math.js

A javascript package that makes doing math operations very easy and simple

How to Use:

npm install easy-math.js

both: [n1, n2, n3] and 'n1, n2, n3' (array and string) are supported as parameters.

Global Rules: The operation is performed upon the first parameter and 0, or 1(multiplication and other operations like it, because if it was 0, it would always return 0(0 x anything = 0)), and then between the answer of that and the next parameter, effectively like using parenthesis, so for certain operations, like power, order matters tremendously.

Example

const math = require('ez-math.js'); //importing the package

console.log(math.add('1, 2, 3, 4')); //returns 10

console.log(math.add([1, 2, 3 , 4])); //also returns 10

console.log(math.subtr([1, 2, 3, 4])) //subtracts all parameters from 0, this returns -10

console.log(math.div([1, 2, 3])) //divides the first 2 parameters(1 and 2), and gets 0.5; divides that by next param and returns what it has when there are no more params to loop through. this returns 0.1666...

console.log(math.multi('1, 2, 3, 4, 5')) //multiplies all parameters together, this returns 120.

console.log(math.pow('10, 2, 4')) //treated as parentheses; raises 1st param ^ 2nd param(10^2), and then raises the answer to the next param and repeats until there are no more parameters to loop through.

Methods:

add - adds all of the numbers specified

Parameters - array(required)

type: string or array

example: math.add([1, 2, 3, 4]) OR math.add('1, 2, 3 ,4') 1 STRING, the commas are inside the string, not representing new strings.

subtr - subtracts all of the numbers specified in the same order

Parameters - array(required)

type: string or array

example: math.subtr([1, 2, 3, 4]) - returns -8 (executes [(1-2)-3]-4)

multi - multiplies all numbers specified

Parameters - array(required)

type: string or array

example: math.multi([1, 2, 3, 4]) returns 24 (executes [(1 * 2) * 3] * 4)

div - divides all numbers specified in the same order

Parameters - array(required)

type: string or array

example: math.div([1, 2, 3, 4]) - returns 0.041666666666666664 (executes [(1 / 2) / 3] / 4)

pow - raises array[0] to array[1] and raises that to the next parameter. - continues until there is nothing else to loop through(see example for better understanding)

Parameters - array(required)

type: string or array

example: math.pow([5, 2, 3]) - returns 15625 (executes [5 ^ 2] ^ 3)(the same as: math.pow([5, math.multi([2, 3])])), which multiplies 2 and 3, getting 6, and raises 5 to that(5^6)

avg - takes the average value of numbers in an array.

Parameters - array(required)

type: string or array

example math.avg('1, 2, 3, 4, 5') - returns 3, because the average value of the numbers is 3.

Example