1.1.0 • Published 6 years ago

math-operations v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Math Operations

Math Operations is a module with lots of mathematical operations.

Installation

npm install math-operations

Importing

const mathOps = require('math-operations');  

Usage

Factorial
Returns the factorial of the number sent as parameter.

mathOps.factorial(5);

Fibonacci
Returns the fibonacci of the number sent as parameter.

mathOps.fibonacci(5);

Sum
Return the sum of the numbers sent as parameters.

mathOps.sum(1, 8, 5, 2);

Bubble Sort
Return the array sent as parameter sorted with bubble sort algorithm.

mathOps.bubbleSort([8, 2, 3, 1]);

Perfect Numbers
Return true case the number sent as parameter is perfect.

mathOps.isPerfect(6);

Prime Numbers
Return true case the number sent as parameter is prime.

mathOps.isPrime(7);

Even or Odd
Two different methods that return a boolean according to the parameter sent.

Returns true case the number sent as parameter is an even number
mathOps.isEven(4);
Returns true case the number sent as parameter is an odd number
mathOps.isOdd(3);
1.1.0

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago