sridhar-math-module
v1.0.3
Published
it is wrapper of math functions in Javascript
Downloads
1
Maintainers
Readme
sridhar-math-module
- Some of the Math Operations in Javascript
sridhar-math-module
- In this Module Provide some of the Math Operation's. We can do Some type of Math operations with the help of this module
Prerequisites
On Ubuntu/Debian:
sudo apt install npm nodejs
On Windows: npm install -g npm
Installation
Use Node to install from NPM Package Module
$ npm install <module name> --save
Usage of sridhar-math-module
Importing module with the help of creating node object
var sridhar-math-module = require('sridhar-math-module');
Addititon of two values
Usage
var addtiton = sridhar-math-module.add(value1,value2);
console.log(addtiton);
Example
var subtraction = sridhar-math-module.add(10,10);
console.log(addtiton);
Output
20
Subtraction of two values
Usage
var subtraction = sridhar-math-module.sub(value1,value2);
console.log(subtraction);
Example
var subtraction = sridhar-math-module.sub(100,10);
console.log(subtraction);
Output
90
Multiplication of two values
Usage
var multiplication = sridhar-math-module.mul(value1,value2);
console.log(multiplication);
Example
var multiplication = sridhar-math-module.mul(10,10);
console.log(multiplication);
Output
100
Division of two values
Usage
var division = sridhar-math-module.div(value1,value2);
console.log(division);
Example
var division = sridhar-math-module.div(100,10);
console.log(division);
Output
10
Factorial of the given Number
Usage
var factorial = sridhar-math-module.fact(value);
console.log(factorial);
Example
var factorial = sridhar-math-module.fact(5);
console.log(factorial);
Output
120
Power of the given Number
Usage
var pow = sridhar-math-module.pow(value1,values2);
console.log(pow);
Example
var pow = sridhar-math-module.pow(2,3);
console.log(pow);
Output
8
Find the given string's are equal or not
Usage
var equals = sridhar-math-module.equals(value1,values2);
console.log(equals);
Example
var equals = sridhar-math-module.equals('Hello world','Hello world');
console.log(equals);
Output
true
Find the greater value
Usage
var greater = sridhar-math-module.grt(value1,value2);
console.log(greater);
Example
var greater = sridhar-math-module.grt(100,102);
console.log(greater);
Output
102
Find the Lesser value
Usage
var lesser = sridhar-math-module.lser(value1,value2);
console.log(lesser);
Example
var lesser = sridhar-math-module.lser(100,120);
console.log(lesser);
Output
100
Find the Greater than or Equals value of the given values
Usage
var grt_equal = sridhar-math-module.grt_equl(value1,value2);
console.log(grt_equal);
Example
var grt_equal = sridhar-math-module.grt_equl(100,102);
console.log(grt_equal);
Output
true
Find the Greater than or Equals value of the given values
Usage
var lessequal = sridhar-math-module.lessequl(value1,value2);
console.log(lessequl);
Example
var lessequl = sridhar-math-module.lessequl(100,102);
console.log(lessequl);
Output
true
Find the Assending order of the given array
Usage
var sort = sridhar-math-module.sort(array);
console.log(sort);
Example
var sort = sridhar-math-module.sort([9,6,7,5,3,1,3,2,4]);
console.log(sort);
Output
1,2,3,4,5,6,7,8,9
Find the Reverse order of the given array
Usage
var rev_sort = sridhar-math-module.sort_reverse(array);
console.log(rev_sort);
Example
var rev_sort = sridhar-math-module.sort_reverse([9,6,7,5,3,1,3,2,4]);
console.log(rev_sort);
Output
9,8,7,6,5,4,3,2,1
Find the Reverse order of the given each Word
Usage
var reverse_each_word = sridhar-math-module.reverse_each_word(string, separator);
console.log(reverse_each_word);
Example
<!-- var reverse_each_word = sridhar-math-module.reverse_each_word("sridhar", "separator); TODO:Find the Seperate meaning -->
console.log(reverse_each_word);
Find the Given value is Integer or Not
Usage
var isInt = sridhar-math-module.isInt(Number);
console.log(isInt);
Example
var isInt = sridhar-math-module.isInt(10);
console.log(isInt);
Output
true
Create Copy of the Given Array
Usage
var duplicate_arr = sridhar-math-module.duplicate_arr(array);
console.log(duplicate_arr);
Example
var duplicate_arr = sridhar-math-module.duplicate_arr([1,2,3,4,5,6,7,7]);
console.log(duplicate_arr);
Output
[1,2,3,4,5,6,7],[1,2,3,4,5,6,7] TODO: check the Given output
Create Copy of the Given Array
Usage
var duplicate_arr = sridhar-math-module.duplicate_arr(array);
console.log(duplicate_arr);
Example
var duplicate_arr = sridhar-math-module.duplicate_arr([1,2,3,4,5,6,7,7]);
console.log(duplicate_arr);
Output
[1,2,3,4,5,6,7]
Find the Given String is Anagram or Not Anagram string
Usage
var anagrams = sridhar-math-module.anagrams(string1,stirng2); TODO: Check the input values Input1 and Input2
console.log(anagrams);
Example
var anagrams = sridhar-math-module.anagrams("example","example");
console.log(anagrams);
Output
[1,2,3,4,5,6,7] TODO: Check the output of the Given string's
Find the Sum of the Given Array
Usage
var Sum_array = sridhar-math-module.Sum_array(Array);
console.log(Sum_array);
Example
var Sum_array = sridhar-math-module.Sum_array([1,2,3,4,5]);
console.log(Sum_array);
Output
15
Find if the divisor is Divided by Divisor
Usage
var divisible_by_value = sridhar-math-module.divisible_by_value(Dividend,Divisor);
console.log(divisible_by_value);
Example
var divisible_by_value = sridhar-math-module.divisible_by_value(10,3);
console.log(divisible_by_value);
Output
false
Find the GCD of the Two values
Usage
var gcd_two_numbers = sridhar-math-module.gcd_two_numbers(x,y);
console.log(gcd_two_numbers);
Example
var gcd_two_numbers = sridhar-math-module.gcd_two_numbers(10,10);
console.log(gcd_two_numbers);
Output
false TODO: check the GCD of the two values
Find the Absolute value
Usage
var abs = sridhar-math-module.abs(x);
console.log(abs);
Example
var abs = sridhar-math-module.abs(-10);
console.log(abs);
Output
10 TODO: check the Absolute value of the output
Find the Duplicate values are present in the Given Array
Usage
var findDuplicates = sridhar-math-module.findDuplicates(x);
console.log(findDuplicates);
Example
var findDuplicates = sridhar-math-module.findDuplicates([1,2,1,2,3,4,5,3,2,3]);
console.log(findDuplicates);
Output
1,2,3
Find the Given value the Number is Positive or Negative or Zero
Usage
var get_positive_or_negative = sridhar-math-module.get_positive_or_negative(x);
console.log(get_positive_or_negative);
Example
var get_positive_or_negative = sridhar-math-module.get_positive_or_negative(-1);
console.log(get_positive_or_negative);
Output
-1 is negative number
Find the Greater Element is Present in the Array
Usage
var greater_element_arr = sridhar-math-module.greater_element_arr(array);
console.log(greater_element_arr);
Example
var greater_element_arr = sridhar-math-module.greater_element_arr([1,2,3,56,72,01,23,3435]);
console.log(greater_element_arr);
Output
3435
Find the Greater Element is Present in the Array
Usage
var lower_element_arr = sridhar-math-module.lower_element_arr(array);
console.log(lower_element_arr);
Example
var lower_element_arr = sridhar-math-module.lower_element_arr([1,2,3,56,72,01,23,3435]);
console.log(lower_element_arr);
Output
1
Find the Revese order of the Given Array
Usage
var array_reverse = sridhar-math-module.array_reverse(array);
console.log(array_reverse);
Example
var array_reverse = sridhar-math-module.array_reverse([1,2,3,4,5,6]);
console.log(array_reverse);
Output
6,5,4,3,2,1
Remove the Element by Given the Index and Returns the Given or Specified size of the Array
Usage
var remove_by_length = sridhar-math-module.remove_by_length(array,len);
console.log(remove_by_length);
Example
var remove_by_length = sridhar-math-module.remove_by_length([1,2,3,4,5,6],3);
console.log(remove_by_length);
Output
1,2,3
Remove the End of the Element in the Given Array
Usage
var remove_beginning_element_array = sridhar-math-module.remove_last_element_array(array);
console.log(remove_last_element_array);
Example
var remove_last_element_array = sridhar-math-module.remove_last_element_array([1,2,3,4,5,6]);
console.log(remove_last_element_array);
Output
1,2,3,4,5
Remove the End of the Element in the Given Array
Usage
var remove_beginning_element_array = sridhar-math-module.remove_beginning_element_array(array);
console.log(remove_beginning_element_array);
Example
var remove_beginning_element_array = sridhar-math-module.remove_beginning_element_array([1,2,3,4,5,6]);
console.log(remove_beginning_element_array);
Output
2,3,4,5,6
Remove the Specific index of the Element in the Given Array
Usage
var remove_specific_index__element_array = sridhar-math-module.remove_specific_index__element_array(array,index);
console.log(remove_specific_index__element_array);
Example
var remove_specific_index__element_array = sridhar-math-module.remove_specific_index__element_array([1,2,3,4,5,6],6);
console.log(remove_specific_index__element_array);
Output
2,3,4,5
Find the Given elememt is Perfect Number or Not
Usage
var perfect_number = sridhar-math-module.perfect_number(number);
console.log(perfect_number);
Example
var perfect_number = sridhar-math-module.perfect_number(TODO: Check the Input Element);
console.log(perfect_number);
Output
2,3,4,5, TODO:
Find the Reverse of the Given String
Usage
var reverseString = sridhar-math-module.reverseString(string);
console.log(reverseString);
Example
var reverseString = sridhar-math-module.reverseString("Hello World");
console.log(reverseString);
Output
dlroW olleH
Find the Sorting order of the Given Array
Usage
var sort_array_element = sridhar-math-module.sort_array_element(array);
console.log(sort_array_element);
Example
var sort_array_element = sridhar-math-module.sort_array_element([1,6,7,3,98,454]);
console.log(sort_array_element);
Output
1,3,6,7,98,454