more-math
v1.0.2
Published
More Math Functions
Downloads
5
Maintainers
Readme
Path to file for index.html: "./node_modules/more-math/index.js"
Math.permutate(str) takes a string as an argument and returns all possible combinations (warning. May fail on long strings)
Math.avg(arr) takes an array as an argument and returns the average of all the values.
Math.median(arr) takes an array as an argument and returns the median of all the values.
deepCloneObj(obj) (non-MATH) Takes an object as an argument and returns a deep copy of that object.
Math.flattenArray(arr) takes an array (flat or an array of arrays) and flattens it into a single array, no matter how nested.
Math.deepArraySum(arr) takes an array (however nested) and returns the sum of all numbers in those arrays.
Math.deepArrayProduct(arr) takes an array (however nested) and returns the product of all numbers in those arrays.
Math.factorial(num) takes a number and returns the factorial value of that number
Math.allEven(arr) takes an array (no matter how nested) and returns all of the even values as an array
Math.allOdd(arr) takes an array (no matter how nested) and returns all of the odd values as an array
Math.isPrime(num) takes a number and returns true if it is a prime number
12 Math.fibonacci(num) performs the fibonacci on a number
Math.GCD(num1, num2) takes two numbers as an argument and finds the greatest common divisor between them.
Math.farenheit(celsius) convert a temp in celsius to farenheit
Math.celsius(farenheit) convert a temp in farenheit to celsius
Math.cmToInches(cm) converts a value in centimeters to inches
Math.inchToCentimeters(inch) converts a value in inches to centimeters
Math.circleArea(radius) takes a radius of a circle and returns the area of that circle.
Math.circlePerimeter takes a radius of a circle and returns the perimeter of that circle.
Math.nRoot(base, nth) takes a base value and a root value, and returns that root of the base.
Math.areaTriangle(base, height) takes a base and height value and returns the area of that triangle.
Math.thousandsCommas(num) takes a number of returns that number with commas in the thousands spots(ex. 10000 => 10,000) (does not work with decimals)
Math.milesToKilometers(miles) takes a number of miles and returns that value in Kilometers
Math.KilometersToMiles(kilo) takes a number of kilometers and returns that value in miles