With web application all the time we face many problems to implement some logic, but in logic, we want some common mathematical applications like GCD, sum of all digits and this makes our implementation more complex hence If you want all these common math problems solved, then you can use solverjs. SolverJS are a combination of many common mathematical and some very used logic solutions.
Finally, jsDelivr CDN is available so you can now use the SolverJs in your non-npm project and we use 'let' over the 'const' so you freely use SolverJs package within an old codebase also.
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js. Node.js 4.2.4 or higher is required.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
npm i solverjs
yarn add solverjs
// Load the full solverjs.
var solverjs = require('solverjs');
// The getFib return the n'th fibonacci number.
var ans = solverjs.getFib(8);
// The 8'th fibonacci number is 8.
// Output should be : 21
The info () function is used to print a concise summary of a all solverjs methods.
// The info function are give the information about the solverjs methods.
solverjs.info();
// The output is : information about the module.
The Fibonacci numbers form a sequence such that each number is the sum of the two preceding numbers, starting from 0 and 1 getFib function to calculate the nth term of the Fibonacci sequence.
// The getFib function are return the n'th fibonacci number.
console.log(solverjs.getFib(8));
// The 8'th fibonacci number is : 8.
The GCD is a mathematical term for the Greatest Common Divisor of two or more numbers. It is the Greatest common divisor that completely divides two or more numbers without leavingany remainder.
console.log(solverjs.getGcd(12, 24));
// The output is : 12.
The Fibonacci numbers form a sequence such that each number is the sum of the two preceding numbers, starting from 0 and 1 we use the recursive printFib function that takes a number n as a parameter and display Fibonacci sequence uoto nth place . The first few Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89…
console.log(solverjs.printFib(8));
// Fibonacci Series : 1 1 2 3 5 8 13 21
Function that takes a number and returns sum of the digit the given number.
console.log(solverjs.sumAllDighti(123));
// The output is : 6
reverseNumber function that takes in a number and returns its reversed number.
console.log(solverjs.reverseNumber(935));
// The output is : 539
An Armstrong number is a number such that the sum ! of its digits raised to the third power is equal to the number ! itself. 153 is an Armstrong number. 153 = (111)+ (555)+ (333)
// The isArmstrong function are return true/false according
// to the given number.
console.log(solverjs.isArmstrong(153));
// The output is : true
The sumOfN function returns the sum of n natural numbers.
console.log(solverjs.sumOfN(5));
// The output is : 15
Factorial is the product of a given positive integer multiplied by all lesser positive integers. Zero Factorial is interesting ... it is generally agreed that 0! = 1.
// The fac function are return the factoril of the given number.
console.log(solverjs.fac(5));
// The output is : 120
The function pow() is used to calculate the power raised to the base value. It takes two arguments. It returns the power raised to the base value.
// The pow function are return the power of x^y.
console.log(solverjs.pow(4, 2));
// The output is : 16
len function returns the number of characters in a given string or number. len takes just one argument, string or number.
console.log(solverjs.len(1234));
// The output is : 4
Prime numbers are the positive integers having only two factors, 1 and the integer itself.
// The isPrime function are return the true or false according
// to the number is prime or not
console.log(solverjs.isPrime(2));
// The output is : true
A Co-prime number is a set of numbers or integers which have only 1 as their common factor i.e. their highest common factor (HCF) will be 1.
// The isCoPrime function are return the true/false
// acording the both number are co-prime or not.
console.log(solverjs.isCoPrime(13, 34));
// The output is : true
A Krishnamurthy number is a number whose sum of the factorial of digits is equal to the number itself. For example 145, sum of factorial of each digits: 1! + 4! + 5! = 1 + 24 + 120 = 145 isKishnamurthyNumbrer is a boolean function that take number as agrument and return true/false.
console.log(solverjs.isKishnamurthyNumber(145));
// The output is : true
The average calculated by avg is the arithmetic mean (the sum of the values divided by the number of values).
// Average - is a term mid of the all given data point.
console.log(solverjs.avg([5, 6, 8, 9, 3]));
// The output is : 6.2
mod function return absolute value of a number is the number without its sign.
console.log(solverjs.mod(-145));
// The output is : 145
This method relies on the number of words present in the input string to count the number of words as every word in a sentence is separated by a space.
// Word Counter is count he word of the given string.
// provide seperator.
console.log(solverjs.wordCount('alsdjf lasjfd lsjf', ' '));
// The output is : 3
A leap year is a year with 366 days instead of 365; every 4 years in February one extra day is added. The isLeap year check the given year is leap or not and return true/false.
console.log(solverjs.isLeap(2021));
// The output is : false
Least Common Multiple(LCM) is a method to find the smallest common multiple between any two or more numbers. A common multiple is a number which is a multiple of two or more numbers. lcm function takes two numbers as argument and return lcm of these number.
console.log(solverjs.lcm(12, 3));
// The output is : 12
The greatest number which divides each of the two or more numbers is called HCF or Highest Common Factor. It is also called the Greatest Common Measure(GCM) and Greatest Common Divisor(GCD). hcf function takes two numbers as argument and return hcf of these number.
console.log(solverjs.hcf(72, 23));
// The output is : 1
ASCII (which stands for American Standard Code for Information Interchange) is a character encoding standard for text files in computers and other devices. ASCII is a subset of Unicode and is made up of 128 symbols in the character set. ascii method is returning equivalent numeric ascii value for the given character.
// Find the ascii value of the given character.
console.log(solverjs.ascii('A'));
// The output is : 65
The method reverse the given string.
console.log(solverjs.reverse('abcde'));
// The output is : edcba
A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar. The isPalindrome check the given stirng is palindrome or not.
console.log(solverjs.isPalindrome('abcba'));
// The output is : true
A permutation is an arrangement of objects in a definite order. The members or elements of sets are arranged here in a sequence or linear order. permutation function take one string argument and return all combination of string.
console.log(solverjs.permutation('abc'));
// The output is : [ 'abc', 'acb', 'bac', 'bca', 'cab', 'cba' ]
The alternativeStringArrange takes two string argument alternative merge the character and return new merge string.
console.log(solverjs.alternativeStringArrange('abcde', 'xyz'));
// The output is : axbyczde
// Time Complexity O(n)
The phoneValidator takes number as argument and check the numebr is a valid or not , return true/false.
console.log(solverjs.phoneValidator('+910011223344'));
// The output is : true
The phoneExtractor takes string as argument ,find the phone number in stirng and return phone number.
console.log(solverjs.phoneExtractor('this is no. +910011223344'));
// The output is : +910011223344
Alphanumericals are a combination of alphabetical and numerical characters, and is used to describe the collection of Latin letters.
// The isAlNum method check the given string
// alphanumeric or not return boolean value.
console.log(solverjs.isAlNum('55x'));
// The output is : true
The isAlpha method check the givne string alpha or not return boolean value.
console.log(solverjs.isAlpha('55'));
// The output is : false
The numToAscii method that converts a decimal number into ASCII or char value.
console.log(solverjs.numToAscii(97));
// The output is : a
isDecimal is a function that returns true if all characters in a string are decimal. If all characters are not decimal then it returns false.
console.log(solverjs.isDecimal('55'));
// The output is : true
The isLower method are used for check the all charector in lower case form or not.
console.log(solverjs.isLower('lower'));
// The output is : true
The isUpper method are used for check the all charector in upper case form or not.
console.log(solverjs.isUpper('UPPER'));
// The output is : true
The isTitle method returns True if all words in a text start with a upper case letter, AND the rest of the word are lower case letters, otherwise False.
// The isTitle method are used for check the
// given string in title form or not.
console.log(solverjs.isTitle('Title'));
// The output is : true
The isSpace method returns True if all the characters in a string are whitespaces, otherwise False.
// The isSpace method are used for check the given
// string is all character in space or not.
console.log(solverjs.isSpace(' '));
// The output is : true
The token method provides a unique token value for any kind of authentication in string format.
console.log(solverjs.token());
// The output is : l\sF\h1402241vmEY@xkFziVNp (unique token)
randomint function takes two argument as a range and generates a random integer between the given range.
console.log(solverjs.randomInt(5, 9));
// The output is : 7
remainder returns the remainder of a number divided by another number. remainder function take 2 number as a argument and return the remainder (first number divide by Second number). remember second number can't be 0,function returns an error as you cannot divide by 0.
// Use to find the remainder or modulo division.
console.log(solverjs.remainder(5, 2));
// The output is : 1
The Fibonacci numbers form a sequence such that each number is the sum of the two preceding numbers, starting from 0 and 1. isFibonacci is a boolean function that take one number as argument , checks the number is a fibonacci number or not and return true/false;
console.log(solverjs.isFibonacci(5));
// The output is : true
We all know we have very frequently is number system conversion in programming, our number system conversion methods provide all type of conversion of the numbers systems.
- Hexadecimal Number System [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F ]
- Decimal Number System [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
- Octal Number System [ 0, 1, 2, 3, 4, 5, 6, 7 ]
- Binary Number System [ 0, 1 ]
// The hexToDec function are take a hexadecimal value and return
// decimal value.
console.log(solverjs.hexToDec(18));
// The output is : 24
// The hexToOct function are take a hexadecimal value and return
// octal value.
console.log(solverjs.hexToOct(18));
// The output is : 30
// The hexToBin function are take a hexadecimal value and return
// binary value.
console.log(solverjs.hexToBin(18));
// The output is : 11000
// The decToHex function are take a decimal value and return
// hexadecimal value.
console.log(solverjs.decToHex(18));
// The output is : 12
// The decToOct function are take a decimal value and return
// octal value.
console.log(solverjs.decToOct(18));
// The output is : 22
// The decToBin function are take a decimal value and return
// binary value.
console.log(solverjs.decToBin(18));
// The output is : 10010
// The octToHex function are take a octal value and return
// hexadecimal value.
console.log(solverjs.octToHex(11236));
// The output is : 129E
// The octToDec function are take a octal value and return
// decimal value.
console.log(solverjs.octToDec(11236));
// The output is : 4766
// The octToBin function are take a octal value and return
// binary value.
console.log(solverjs.octToBin(11236));
// The output is : 1001010011110
// The binToHex function are take a binary value and return
// hexadecimal value.
console.log(solverjs.binToHex('010110101'));
// The output is : B5
// The binToDec function are take a binary value and return
// decimal value.
console.log(solverjs.binToDec('010110101'));
// The output is : 181
// The binToOct function are take a binary value and return
// octal value.
console.log(solverjs.binToOct('010110101'));
// The output is : 265
The length conversion is used very frequently in the many time in code base so if you want a solution use this method.
The length has many types but in this time we see only some very frequently used.
- Kilometer(km)
- Meter(me)
- Centimeter(cm)
- Millimeter(mm)
- Micormeter(Um)
- Nanometer(nm)
- Yard(yd)
- Foot(ft)
- Inch(in)
// the kmToMe() function are take kilometer value and return there
// meter value.
console.log(solverjs.kmToMe(1));
// The output is : 1000
// the kmToCm() function are take kilometer value and return there
// centimeter value.
console.log(solverjs.kmToCm(1));
// The output is : 100000
// the kmToMm() function are take kilometer value and return there
// millimeter value.
console.log(solverjs.kmToMm(1));
// The output is : 1000000
// the kmToUm() function are take kilometer value and return there
// micrometer value.
console.log(solverjs.kmToUm(1));
// The output is : 1000000000
// the kmToNm() function are take kilometer value and return there
// nanometer value.
console.log(solverjs.kmToNm(1));
// The output is : 1000000000000
// the kmToYd() function are take kilometer value and return there
// Yard value.
console.log(solverjs.kmToYd(1));
// The output is : 1094
// the kmToFt() function are take kilometer value and return there
// Foot value.
console.log(solverjs.kmToFt(1));
// The output is : 3281
// the kmToIn() function are take kilometer value and return there
// Inch value.
console.log(solverjs.kmToIn(1));
// The output is : 39370
// the meToKm() function are take meter value and return there
// kilometer value.
console.log(solverjs.meToKm(1));
// The output is : 0.001
// the meToCm() function are take meter value and return there
// centimeter value.
console.log(solverjs.meToCm(1));
// The output is : 100
// the meToMm() function are take meter value and return there
// millimeter value.
console.log(solverjs.meToMm(1));
// The output is : 1000
// the meToUm() function are take meter value and return there
// micrometres value.
console.log(solverjs.meToUm(1));
// The output is : 1000000
// the meToNm() function are take meter value and return there
// nanometre value.
console.log(solverjs.meToNm(1));
// The output is : 1000000000
// the meToYd() function are take meter value and return there
// yard value.
console.log(solverjs.meToYd(1));
// The output is : 1.094
// the meToFt() function are take meter value and return there
// foot value.
console.log(solverjs.meToFt(1));
// The output is : 3.281
// the meToIn() function are take meter value and return there
// inch value.
console.log(solverjs.meToIn(1));
// The output is : 39.37
// the cmToKm() function are take centimeter value and return there
// kilometer value.
console.log(solverjs.cmToKm(1));
// The output is : 0.00001
// the cmToMe() function are take centimeter value and return there
// meter value.
console.log(solverjs.cmToMe(1));
// The output is : 0.01
// the cmToMm() function are take centimeter value and return there
// millimeter value.
console.log(solverjs.cmToMm(1));
// The output is : 10
// the cmToUm() function are take centimeter value and return there
// micrometres value.
console.log(solverjs.cmToUm(1));
// The output is : 10000
// the cmToNm() function are take centimeter value and return there
// nanometre value.
console.log(solverjs.cmToNm(1));
// The output is : 10000000
// the cmToYd() function are take centimeter value and return there
// yard value.
console.log(solverjs.cmToYd(1));
// The output is : 0.010936132983377079
// the cmToFt() function are take centimeter value and return there
// foot value.
console.log(solverjs.cmToFt(1));
// The output is : 0.03280839895013123
// the cmToIn() function are take centimeter value and return there
// inch value.
console.log(solverjs.cmToIn(1));
// The output is : 0.39370078740157477
// the mmToKm() function are take millimetre value and return there
// kilometer value.
console.log(solverjs.mmToKm(1));
// The output is : 0.000001
// the mmToMe() function are take millimetre value and return there
// meter value.
console.log(solverjs.mmToMe(1));
// The output is : 0.001
// the mmToMm() function are take millimetre value and return there
// centimeter value.
console.log(solverjs.mmToCm(1));
// The output is : 0.1
// the mmToUm() function are take millimetre value and return there
// micrometres value.
console.log(solverjs.mmToUm(1));
// The output is : 1000
// the mmToNm() function are take millimetre value and return there
// nanometre value.
console.log(solverjs.mmToNm(1));
// The output is : 1000000
// the mmToYd() function are take millimetre value and return there
// yard value.
console.log(solverjs.mmToYd(1));
// The output is : 0.0010940919037199124
// the mmToFt() function are take millimetre value and return there
// foot value.
console.log(solverjs.mmToFt(1));
// The output is : 0.003278688524590164
// the mmToIn() function are take millimetre value and return there
// inch value.
console.log(solverjs.mmToIn(1));
// The output is : 0.03937007874015748
// the umToKm() function are take micrometre value and return there
// kilometer value.
console.log(solverjs.umToKm(1));
// The output is : 0.000000001
// the umToMe() function are take micrometre value and return there
// meter value.
console.log(solverjs.umToMe(1));
// The output is : 0.000001
// the umToMm() function are take micrometre value and return there
// centimeter value.
console.log(solverjs.umToCm(1));
// The output is : 0.0001
// the umToMm() function are take micrometre value and return there
// millimetre value.
console.log(solverjs.umToMm(1));
// The output is : 0.001
// the umToNm() function are take micrometre value and return there
// nanometre value.
console.log(solverjs.umToNm(1));
// The output is : 1000
// the umToYd() function are take micrometre value and return there
// yard value.
console.log(solverjs.umToYd(1));
// The output is : 0.0000010936132983377078
// the umToFt() function are take micrometre value and return there
// foot value.
console.log(solverjs.umToFt(1));
// The output is : 0.0000032808398950131235
// the umToIn() function are take micrometre value and return there
// inch value.
console.log(solverjs.umToIn(1));
// The output is : 0.00003937007874015748
// the nmToKm() function are take nanometer value and return there
// kilometer value.
console.log(solverjs.nmToKm(1));
// The output is : 0.000000000001
// the nmToMe() function are take nanometer value and return there
// meter value.
console.log(solverjs.nmToMe(1));
// The output is : 0.000000001
// the nmToMm() function are take nanometer value and return there
// centimeter value.
console.log(solverjs.nmToCm(1));
// The output is : 0.0000001
// the nmToMm() function are take nanometer value and return there
// millimetre value.
console.log(solverjs.nmToMm(1));
// The output is : 0.000001
// the nmToNm() function are take nanometer value and return there
// micrometre value.
console.log(solverjs.nmToUm(1));
// The output is : 0.001
// the nmToYd() function are take nanometer value and return there
// yard value.
console.log(solverjs.nmToYd(1));
// The output is : 1.0936132983377077e-9
// the nmToFt() function are take nanometer value and return there
// foot value.
console.log(solverjs.nmToFt(1));
// The output is : 3.2808398950131233e-9
// the nmToIn() function are take nanometer value and return there
// inch value.
console.log(solverjs.nmToIn(1));
// The output is : 3.937007874015748e-8
// the ydToKm() function are take Yard value and return there
// kilometer value.
console.log(solverjs.ydToKm(1));
// The output is : 0.0009140767824497258
// the ydToMe() function are take Yard value and return there
// meter value.
console.log(solverjs.ydToMe(1));
// The output is : 0.9140767824497257
// the ydToCm() function are take Yard value and return there
// centimeter value.
console.log(solverjs.ydToCm(1));
// The output is : 91.44
// the ydToMm() function are take Yard value and return there
// millimetre value.
console.log(solverjs.ydToMm(1));
// The output is : 914
// the ydToUm() function are take Yard value and return there
// micrometre value.
console.log(solverjs.ydToUm(1));
// The output is : 914400
// the ydToNm() function are take Yard value and return there
// nanometre value.
console.log(solverjs.ydToNm(1));
// The output is : 914400000
// the ydToFt() function are take Yard value and return there
// foot value.
console.log(solverjs.ydToFt(1));
// The output is : 3
// the ydToIn() function are take Yard value and return there
// inch value.
console.log(solverjs.ydToIn(1));
// The output is : 36
// the ftToKm() function are take foot value and return there
// kilometer value.
console.log(solverjs.ftToKm(1));
// The output is : 0.00030478512648582747
// the ftToMe() function are take foot value and return there
// meter value.
console.log(solverjs.ftToMe(1));
// The output is : 0.30478512648582745
// the ftToCm() function are take foot value and return there
// centimeter value.
console.log(solverjs.ftToCm(1));
// The output is : 30.48
// the ftToMm() function are take foot value and return there
// millimetre value.
console.log(solverjs.ftToMm(1));
// The output is : 305
// the ftToUm() function are take foot value and return there
// micrometre value.
console.log(solverjs.ftToUm(1));
// The output is : 304800
// the ftToNm() function are take foot value and return there
// nanometre value.
console.log(solverjs.ftToNm(1));
// The output is : 304800000
// the ftToYd() function are take foot value and return there
// yard value.
console.log(solverjs.ftToYd(1));
// The output is : 0.3333333333333333
// the ftToIn() function are take foot value and return there
// inch value.
console.log(solverjs.ftToIn(1));
// The output is : 12
// the inToKm() function are take inch value and return there
// kilometer value.
console.log(solverjs.inToKm(1));
// The output is : 0.0000254000508001016
// the inToMe() function are take inch value and return there
// meter value.
console.log(solverjs.inToMe(1));
// The output is : 0.025400050800101603
// the inToCm() function are take inch value and return there
// centimeter value.
console.log(solverjs.inToCm(1));
// The output is : 2.54
// the inToMm() function are take inch value and return there
// millimetre value.
console.log(solverjs.inToMm(1));
// The output is : 25.4
// the inToUm() function are take inch value and return there
// micrometre value.
console.log(solverjs.inToUm(1));
// The output is : 25400
// the inToNm() function are take inch value and return there
// nanometre value.
console.log(solverjs.inToNm(1));
// The output is : 25400000
// the inToYd() function are take inch value and return there
// yard value.
console.log(solverjs.inToYd(1));
// The output is : 0.027777777777777776
// the inToFt() function are take inch value and return there
// foot value.
console.log(solverjs.inToFt(1));
// The output is : 0.08333333333333333
Temperature conversion is one of the most used methods for weather report casting the temperature conversion method gives you all the popular temperature standard conversion methods.
All popular types.
- Celsius
- Fahrenheit
- Kelvin
// the celToFah() function are take the temperature value
// in celsius and convert to the temperature value in fahrenheit.
console.log(solverjs.celToFah(0));
// The output is : 32
// the celToKel() function are take the temperature value
// in celsius and convert to the temperature value in kelvin.
console.log(solverjs.celToKel(0));
// The output is : 273.15
// the fahToCel() function are take the temperature value
// in fahrenheit and convert to the temperature value in celsius.
console.log(solverjs.fahToCel(0));
// The output is : -17.77777777777778
// the fahToKel() function are take the temperature value
// in fahrenheit and convert to the temperature value in kelvin.
console.log(solverjs.fahToKel(0));
// The output is : 255.3722222222222
// the kelToCel() function are take the temperature value
// in kelvin and convert to the temperature value in celsius.
console.log(solverjs.kelToCel(0));
// The output is : -273.15
// the kelToFah() function are take the temperature value
// in kelvin and convert to the temperature value in fahrenheit.
console.log(solverjs.kelToFah(0));
// The output is : -459.66999999999996
Area conversion is more used if you create a site to manage land and area. If you want to make your work easier then we have written some tools that you can use
All popular types.
- Square kilometer
- Square meter
- Square yard
- Square foot
- Square inch
- Hectare
- Acre
// the sqKmToSqMe() function are take the square kilometer value
// and convert to the square meter value.
console.log(solverjs.sqKmToSqMe(1))
// The output is : 1000000
// the sqKmToSqYd() function are take the square kilometer value
// and convert to the square yard value.
console.log(solverjs.sqKmToSqYd(1))
// The output is : 1196000
// the sqKmToSqFt() function are take the square kilometer value
// and convert to the square foot value.
console.log(solverjs.sqKmToSqFt(1))
// The output is : 10760000
// the sqKmToSqIn() function are take the square kilometer value
// and convert to the square inch value.
console.log(solverjs.sqKmToSqIn(1))
// The output is : 1550000000
// the sqKmToHect() function are take the square kilometer value
// and convert to the hectare value.
console.log(solverjs.sqKmToHect(1))
// The output is : 100
// the sqKmToAcre() function are take the square kilometer value
// and convert to the acre value.
console.log(solverjs.sqKmToAcre(1))
// The output is : 247
// the sqMeToSqMe() function are take the square meter value
// and convert to the square meter value.
console.log(solverjs.sqMeToSqKm(1))
// The output is : 0.000001
// the sqMeToSqYd() function are take the square meter value
// and convert to the square yard value.
console.log(solverjs.sqMeToSqYd(1))
// The output is : 1.196
// the sqMeToSqFt() function are take the square meter value
// and convert to the square foot value.
console.log(solverjs.sqMeToSqFt(1))
// The output is : 10.764
// the sqMeToSqIn() function are take the square meter value
// and convert to the square inch value.
console.log(solverjs.sqMeToSqIn(1))
// The output is : 1550
// the sqMeToHect() function are take the square meter value
// and convert to the hectare value.
console.log(solverjs.sqMeToHect(1))
// The output is : 0.0001
// the sqMeToAcre() function are take the square meter value
// and convert to the acre value.
console.log(solverjs.sqMeToAcre(1))
// The output is : 0.00024709661477637757
// the sqYdToSqKm() function are take the square yard value
// and convert to the square meter value.
console.log(solverjs.sqYdToSqKm(1))
// The output is : 8.361204013377926e-7
// the sqYdToSqMe() function are take the square yard value
// and convert to the square meter value.
console.log(solverjs.sqYdToSqMe(1))
// The output is : 0.8361204013377926
// the sqYdToSqFt() function are take the square yard value
// and convert to the square foot value.
console.log(solverjs.sqYdToSqFt(1))
// The output is : 9
// the sqYdToSqIn() function are take the square yard value
// and convert to the square inch value.
console.log(solverjs.sqYdToSqIn(1))
// The output is : 1296
// the sqYdToHect() function are take the square yard value
// and convert to the hectare value.
console.log(solverjs.sqYdToHect(1))
// The output is : 0.00008361204013377926
// the sqYdToAcre() function are take the square yard value
// and convert to the acre value.
console.log(solverjs.sqYdToAcre(1))
// The output is : 0.00020661157024793388
// the sqFtToSqKm() function are take the square foot value
// and convert to the square kilometer value.
console.log(solverjs.sqFtToSqKm(1))
// The output is : 9.29368029739777e-8
// the sqFtToSqMe() function are take the square foot value
// and convert to the square meter value.
console.log(solverjs.sqFtToSqMe(1))
// The output is : 0.0929022668153103
// the sqFtToSqYd() function are take the square foot value
// and convert to the square yard value.
console.log(solverjs.sqFtToSqYd(1))
// The output is : 0.1111111111111111
// the sqFtToSqIn() function are take the square foot value
// and convert to the square inch value.
console.log(solverjs.sqFtToSqIn(1))
// The output is : 144
// the sqFtToHect() function are take the square foot value
// and convert to the hectare value.
console.log(solverjs.sqFtToHect(1))
// The output is : 0.000009290312990644655
// the sqFtToAcre() function are take the square foot value
// and convert to the acre value.
console.log(solverjs.sqFtToAcre(1))
// The output is : 0.00002295684113865932
// the sqInToSqKm() function are take the square inch value
// and convert to the square kilometer value.
console.log(solverjs.sqInToSqKm(1))
// The output is : 6.451612903225806e-10
// the sqInToSqMe() function are take the square inch value
// and convert to the square meter value.
console.log(solverjs.sqInToSqMe(1))
// The output is : 0.0006451612903225806
// the sqInToSqYd() function are take the square inch value
// and convert to the square yard value.
console.log(solverjs.sqInToSqYd(1))
// The output is : 0.0007716049382716049
// the sqInToSqFt() function are take the square inch value
// and convert to the square foot value.
console.log(solverjs.sqInToSqFt(1))
// The output is : 0.006944444444444444
// the sqInToHect() function are take the square inch value
// and convert to the hectare value.
console.log(solverjs.sqInToHect(1))
// The output is : 6.451612903225807e-8
// the sqInToAcre() function are take the square inch value
// and convert to the acre value.
console.log(solverjs.sqInToAcre(1))
// The output is : 1.5941335883947074e-7
// the hectToSqKm() function are take the hectare value
// and convert to the square kilometer value.
console.log(solverjs.hectToSqKm(1))
// The output is : 0.01
// the hectToSqMe() function are take the hectare value
// and convert to the square meter value.
console.log(solverjs.hectToSqMe(1))
// The output is : 10000
// the hectToSqYd() function are take the hectare value
// and convert to the square yard value.
console.log(solverjs.hectToSqYd(1))
// The output is : 11960
// the hectToSqFt() function are take the hectare value
// and convert to the square foot value.
console.log(solverjs.hectToSqFt(1))
// The output is : 107639
// the hectToSqIn() function are take the hectare value
// and convert to the square inch value.
console.log(solverjs.hectToSqIn(1))
// The output is : 15500000
// the hectToAcre() function are take the hectare value
// and convert to the acre value.
console.log(solverjs.hectToAcre(1))
// The output is : 2.471
// the acreToSqKm() function are take the acre value
// and convert to the square kilometer value.
console.log(solverjs.acreToSqKm(1))
// The output is : 0.004048582995951417
// the acreToSqMe() function are take the acre value
// and convert to the square meter value.
console.log(solverjs.acreToSqMe(1))
// The output is : 4047
// the acreToSqYd() function are take the acre value
// and convert to the square yard value.
console.log(solverjs.acreToSqYd(1))
// The output is : 4840
// the acreToSqFt() function are take the acre value
// and convert to the square foot value.
console.log(solverjs.acreToSqFt(1))
// The output is : 43560
// the acreToSqIn() function are take the acre value
// and convert to the square inch value.
console.log(solverjs.acreToSqIn(1))
// The output is : 6273000
// the acreToHect() function are take the acre value
// and convert to the hectare value.
console.log(solverjs.acreToHect(1))
// The output is : 0.4046944556859571
// The utility methods are very helpful in many small projects.
Defined method.
- dateToDay
- dobToAge
- keywordExtractor
- contatinSpecial
- isKeywordExists
- checkCamelCase
- checkFlatCase
- checkKebabCase
- checkPascalCase
- checkSnakeCase
- URLShortener
- railwayTimeConversion
// The dateToDay method takes a string date and returns the
// specific week-day.
console.log(solverjs.dateToDay('01/01/2000'));
// The output is : Saturday
// The dobToAge() method takes a string date and returns
// data delta along with the current date in a string.
console.log(solverjs.dobToAge('01/01/2000'));
// The output is : 21 years 5 months and 29 days
// The keywordExtractor() method is take stirng and
// return the keyword array.
console.log(solverjs.keywordExtractor('This is a special stirng with 5news char.'));
// The output is : [ 'special', 'stirng' ]
// The isKeywordExists() method is take two string
// argument find second to first string.
console.log(solverjs.isKeywordExists('This is a string', 'is');
// The output is : true
// The contatinSpecial() method is take a string
// and return true, if the string containe special later,
// else return false.
console.log(solverjs.contatinSpecial("My $Name is "));
// The output is : true
// CheckCamelCase method checks the given string is in camelCase or not.
console.log(solverjs.checkCamelCase("myVar"));
// The output is : true
// CheckFlatCase method checks the given string is in flatcase or not.
console.log(solverjs.checkFlatCase("myvar"));
// The output is : true
// CheckKebabCase method checks the given string is in kebab-case or not.
console.log(solverjs.checkKebabCase("my-var"));
// The output is : true
// CheckPascalCase method checks the given string is in PascalCase or not.
console.log(solverjs.checkPascalCase("MyVar"));
// The output is : true
// CheckSnakeCase method checks the given string is in snake_case or not.
console.log(solverjs.checkSnakeCase("my_var"));
// The output is : true
// URLShortener is a method sort your interger value in a string value.
console.log(solverjs.URLShortener(12345));
// The output is : dnh
// railwayTimeConversion method take a normalized time and convert railway time.
console.log(solverjs.railwayTimeConversion('07:05:45PM'))
// The output is : 19:05:45
// The matrix mathod are highly optimized.
Defined method.
- matAdd
- matSub
// The matAdd() method are take two matrix and perform
// addition operation.
console.log(solverjs.matAdd([[1, 2], [4, 5]], [[6, 7], [8, 9]]))
// The output is : [ [ 7, 9 ], [ 12, 14 ] ]
// The matSub method are take two matrix and perform
// subtraction operation.
console.log(solverjs.matSub([[1, 2], [4, 5]], [[6, 7], [8, 9]]))
// The output is : [ [ -5, -5 ], [ -4, -4 ] ]
// The matSpiralPrint print the matrix in spiral form.
console.log(solverjs.matSpiralPrint([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))
// The output is : [1, 2, 3, 6, 9, 8, 7, 4, 5]
Digital storage conversion is very useful if you are working with some internal architecture tool or system configuration tools that provide lots of flexibility to work with memory size.
The Digital Storage has many types but in this time we see only some very frequently used.
- Bit(bit)
- Byte(byte)
- KiloByte(kb)
- MegaByte(mb)
- Gigabyte(gb)
- TeraByte(tb)
- PetaByte(pb)
1 bit = 0.125 byte
The bitToByte method are take bit value and return the byte value correspond to the digital storage parameters.
// console.log(solverjs.bitToByte(1))
// The output is : 0.125
1 bit=0.000125 kb
The bitToKb method are take bit value and return the Kilobyte value correspond to the digital storage parameters.
//console.log(solverjs.bitToKb(1))
// The output is : 0.000125
1 bit=0.000000125 mb
The bitToMb method are take bit value and return the Megabyte value correspond to the digital storage parameters.
//console.log(solverjs.bitToMb(1))
// The output is : 1.25e-7
1 bit=0.000000000125 gb
The bitToGb method are take bit value and return the Gigabyte value correspond to the digital storage parameters.
//console.log(solverjs.bitToGb(1))
// The output is : 1.25e-10
1 bit=0.000000000000125 tb
The bitToTb method are take bit value and return the Terabyte value correspond to the digital storage parameters.
//console.log(solverjs.bitToTb(1))
// The output is : 1.25e-13
1 bit=0.000000000000000125 pb
The bitToPb method are take bit value and return the Petabyte value correspond to the digital storage parameters.
//console.log(solverjs.bitToPb(1))
// The output is : 1.25e-16
1 byte=8 bit
The byteToBit method are take byte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.byteToBit(1))
// The output is : 8
1 byte=0.001 kb
The byteToKb method are take byte value and return the Kilobyte value correspond to the digital storage parameters.
console.log(solverjs.byteToKb(1))
// The output is : 0.001
1 byte=0.000001 mb
The byteToMb method are take byte value and return the Megabyte value correspond to the digital storage parameters.
console.log(solverjs.byteToMb(1))
// The output is : 0.000001
1 byte=0.0000000010 gb
The byteToGb method are take byte value and return the Gigabyte value correspond to the digital storage parameters.
console.log(solverjs.byteToGb(1))
// The output is : 1e-9
1 byte=0.0000000000010 tb
The byteToTb method are take byte value and return the Terabyte value correspond to the digital storage parameters.
console.log(solverjs.byteToTb(1)) // The output is : 1e-12
1 byte=0.0000000000000010 pb
The byteToPb method are take byte value and return the Petabyte value correspond to the digital storage parameters.
console.log(solverjs.byteToPb(1))
// The output is : 1e-15
1 kb =8000 bit
The kbToBit method are take kilobyte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.kbToBit(1))
// The output is : 8000
1 kb=1000 byte
The kbToByte method are take kilobyte value and return the Byte value correspond to the digital storage parameters.
console.log(solverjs.kbToByte(1))
// The output is : 1000
1 kb=0.001 mb
The kbToMb method are take kilobyte value and return the Megabyte value correspond to the digital storage parameters.
console.log(solverjs.kbToMb(1))
// The output is : 0.001
1kb=0.000001 gb
The kbToGb method are take kilobyte value and return the Gigabyte value correspond to the digital storage parameters.
console.log(solverjs.kbToGb(1))
// The output is : 0.000001
1 kb=0.0000000010 tb
The kbToTb method are take kilobyte value and return the Terabyte value correspond to the digital storage parameters.
console.log(solverjs.kbToTb(1))
// The output is : 1e-9
1 kb=0.0000000000010 pb
The kbToPb method are take kilobyte value and return the Petabyte value correspond to the digital storage parameters.
console.log(solverjs.kbToPb(1))
// The output is : 1e-12
1 mb=8000000 bit
The mbToBit method are take Megabyte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.mbToBit(1))
// The output is : 8000000
1 mb=1000000 byte
The mbToByte method are take Megabyte value and return the Byte value correspond to the digital storage parameters.
console.log(solverjs.mbToByte(1))
// The output is : 1000000
1 mb=1000 kb
The mbToKb method are take Megabyte value and return the Kilobyte value correspond to the digital storage parameters.
console.log(solverjs.mbToKb(1))
// The output is : 1000
1 mb=0.001 gb
The mbToGb method are take Megabyte value and return the Gigabyte value correspond to the digital storage parameters.
console.log(solverjs.mbToGb(1)) // The output is : 0.001
1 mb=0.000001 tb
The mbToTb method are take Megabyte value and return the Terabyte value correspond to the digital storage parameters.
console.log(solverjs.mbToTb(1))
// The output is : 0.000001
1 mb=0.0000000010 pb
The mbToPb method are take Megabyte value and return the Petabyte value correspond to the digital storage parameters.
console.log(solverjs.mbToPb(1))
// The output is : 1e-9
1 gb= 8000000000 bit
The gbToBit method are take Gigabyte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.gbToBit(1))
// The output is : 8000000000
1 gb=1000000 byte
The gbToByte method are take Gigabyte value and return the Byte value correspond to the digital storage parameters.
console.log(solverjs.gbToByte(1))
// The output is : 1000000000
1 gb=1000000 kb
The gbToKb method are take Gigabyte value and return the Kilobyte value correspond to the digital storage parameters.
console.log(solverjs.gbToKb(1))
// The output is : 1000000
1 gb=1000 mb
The gbToMb method are take Gigabyte value and return the Megabyte value correspond to the digital storage parameters.
console.log(solverjs.gbToMb(1))
// The output is : 1000
1gb=0.001 tb
The gbToTb method are take Gigabyte value and return the Terabyte value correspond to the digital storage parameters.
console.log(solverjs.gbToTb(1))
// The output is :0.001
1 gb=0.000001 pb
The gbToPb method are take Gigabyte value and return the Petabyte value correspond to the digital storage parameters.
console.log(solverjs.gbToPb(1))
// The output is : 0.000001
1 tb=8000000000000 bit
The tbToBit method are take Terabyte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.tbToBit(1))
// The output is : 8000000000000
1 tb=1000000000000 byte
The tbToByte method are take Terabyte value and return the Byte value correspond to the digital storage parameters.
console.log(solverjs.tbToByte(1))
// The output is : 1000000000000
1 tb=1000000000 kb
The tbToKb method are take Terabyte value and return the Kilobyte value correspond to the digital storage parameters.
console.log(solverjs.tbToKb(1))
// The output is : 1000000000
1 tb=1000000 mb
The tbToMb method are take Terabyte value and return the Megabyte value correspond to the digital storage parameters.
console.log(solverjs.tbToMb(1))
// The output is : 1000000
1 tb=1000 gb
The tbToTb method are take Terabyte value and return the Gigabyte value correspond to the digital storage parameters.
console.log(solverjs.tbToTb(1))
// The output is : 1000
1 tb=0.001 pb
The tbToPb method are take Terabyte value and return the Petabyte valuecorrespond to the digital storage parameters.
console.log(solverjs.tbToPb(1))
// The output is : 0.001
1 pb=8000000000000000 bit
The pbToBit method are take Petabyte value and return the Bit value correspond to the digital storage parameters.
console.log(solverjs.pbToBit(1))
// The output is : 8000000000000000
1 pb=1000000000000000 byte
The pbToByte method are take Petabyte value and return the Byte value correspond to the digital storage parameters.
console.log(solverjs.pbToByte(1))
// The output is : 1000000000000000
1 pb=1000000000000 kb
The pbToKb method are take Petabyte value and return the Kilobyte value correspond to the digital storage parameters.
console.log(solverjs.pbToKb(1))
// The output is : 1000000000000
1 pb=1000000000 mb
The pbToMb method are take Petabyte value and return the Megabyte value correspond to the digital storage parameters.
console.log(solverjs.pbToMb(1))
// The output is : 1000000000
1 pb=1000000 gb
The pbToTb method are take Petabyte value and return the Gigabyte value correspond to the digital storage parameters.
console.log(solverjs.pbToTb(1))
// The output is : 1000000
1 pb=1000 tb
The pbToTb method are take Petabyte value and return the Terabyte value correspond to the digital storage parameters.
console.log(solverjs.pbToTb(1))
// The output is : 1000
Sometimes we work with time conversion, at that time we are very confused in calculating the time so we have created a very efficient way to do it. The SI base unit for time is the second. 1 second is equal to 1000000000 nanoseconds, or 3.1688738506811E-8 year.
The Time units has many types but in this we see only some very frequently used.
- Nanosecond(ns)
The method convert nanosecond to Microsecond
The nsToUs method are take nanosecond value and return corrospond microsecond value.
console.log(solverjs.nsToUs(1))
// The output is : 0.001
The method convert nanosecond to Milisecond
The nsToMs method are take nanosecond value and return corrospond milisecond value.
console.log(solverjs.nsToMs(1))
// The output is : 0.000001
The method convert nanosecond to second
The nsToSc method are take nanosecond value and return corrospond second value.
console.log(solverjs.nsToSc(1))
// The output is : 1e-9
The method convert nanosecond to minute
The nsToMi method are take nanosecond value and return corrospond minute value.
console.log(solverjs.nsToMi(1))
// The output is : 1.6666666666666667e-11
The method convert nanosecond to hour
The nsToHr method are take nanosecond value and return corrospond hour value.
console.log(solverjs.nsToHr(1))
// The output is : 2.777777777777778e-13
The method convert nanosecond to day
The nsToDd method are take nanosecond value and return corrospond day value.
console.log(solverjs.nsToDd(1))
// The output is : 1.1574074074074074e-14
The method convert nanosecond to week
The nsToWk method are take nanosecond value and return corrospond week value.
console.log(solverjs.nsToWk(1))
// The output is : 1.6534391534391534e-15
The method convert nanosecond to month
The nsToMm method are take nanosecond value and return corrospond month value.
console.log(solverjs.nsToMm(1))
// The output is : 3.8051750380517503e-16
The method convert nanosecond to year
The nsToYy method are take nanosecond value and return corrospond year value.
console.log(solverjs.nsToYy(1))
// The output is : 3.170577045022194e-17