From f94a50183150dd2a4271eaea44c5f03991fcfdb2 Mon Sep 17 00:00:00 2001 From: Suryapratap Singh Date: Sat, 22 Jan 2022 23:04:14 +0530 Subject: [PATCH] Added typescript declaration for all methods --- index.d.ts | 13 + src/math/math.d.ts | 370 ++++++++++++++++++ src/matrix/matrix.d.ts | 36 ++ src/number/number.d.ts | 94 +++++ src/time/time.d.ts | 90 +++++ src/units/area/area.d.ts | 42 ++ .../digital_storage/digital_storage.d.ts | 42 ++ src/units/length/length.d.ts | 72 ++++ src/units/temperature/temperature.d.ts | 6 + src/utils/utils.d.ts | 139 +++++++ 10 files changed, 904 insertions(+) create mode 100644 index.d.ts create mode 100644 src/math/math.d.ts create mode 100644 src/matrix/matrix.d.ts create mode 100644 src/number/number.d.ts create mode 100644 src/time/time.d.ts create mode 100644 src/units/area/area.d.ts create mode 100644 src/units/digital_storage/digital_storage.d.ts create mode 100644 src/units/length/length.d.ts create mode 100644 src/units/temperature/temperature.d.ts create mode 100644 src/utils/utils.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..cf3a46e --- /dev/null +++ b/index.d.ts @@ -0,0 +1,13 @@ +export * from './src/math/math'; +export * from './src/matrix/matrix'; +export * from './src/number/number'; +export * from './src/time/time'; +export * from './src/units/area/area'; +export * from './src/units/digital_storage/digital_storage'; +export * from './src/units/length/length'; +export * from './src/units/temperature/temperature'; +export * from './src/utils/utils'; +/** + * Gives information about most of the solverjs methods. + */ +export function info(): void; \ No newline at end of file diff --git a/src/math/math.d.ts b/src/math/math.d.ts new file mode 100644 index 0000000..61fab04 --- /dev/null +++ b/src/math/math.d.ts @@ -0,0 +1,370 @@ +/** + * getFib return the n'th fibonacci number. + * @param {Number} arg_n n'th natural number + * @returns return a `n'th fibonacci` number. + */ +export function getFib(arg_n: number): number; + + + /** + * getGcd return the gcd of two numbers. + * @param {Number} arg1 first argument for gcd + * @param {Number} arg2 second argument for gcd + * @returns return a `gcd` vlaue of both number. + */ +export function getGcd(arg1: number, arg2: number): number; + + + /** + * printFib return the fibonacci series string up to n. + * @param {Number} n n'th natural number + * @returns return a `series` of n'th fibonacci numbers. + */ +export function printFib(n: number): string; + + + /** + * sumAllDigit return the addition of all the digits in a given number. + * @param {Number} n n'th natural number. + * @returns return the sum of all digit of n number numebrs. + */ +export function sumAllDigit(n: number): number; + + + /** + * reverseNumber return the reversed value of the given number. + * @param {Number | String} n any digit number. + * @returns `Number` n reverse in reverse. + */ +export function reverseNumber(n: number | string): number; + + + /** + * isArmstrong return the boolean in respenct of the are armstorng or not. + * @param {Number | String} n a number for checking. + * @returns return boolen based on condition the number is armstrong or not. + */ +export function isArmstrong(n: number | string): boolean; + + + /** + * sumOfN return the sum of n natural numbers. + * @param {Number} n natural number in series. + * @returns {Number} sum of n natural numbers. + */ +export function sumOfN(n: number): number; + + + /** + * the `fac` method return the n'th factorial of given number. + * @param {Number} n the number for calculating factorial. + * @returns {BigInt} return n'th factorial value of a number. + */ +export function fac(n: number): BigInt; + + + /** + * the pow function return the calculation of x^y. + * @param {number} x `base` value for operation. + * @param {number} y `exponent` value for operation. + * @returns {number} return the calculation of `x^y`. + */ +export function pow(x: number, y: number): number; + + + /** + * the len function return the length of number or string. + * @param {Number | String} x a given number or string. + * @returns return the `length` of givne number or string. + */ +export function len(x: number | string): number; + + + /** + * the isPrime return boolean in respect of the given number prime or not. + * @param {Number} x n number for checking is prime or not. + * @returns return correspond boolean value, if prime return `ture` else return `false`. + */ +export function isPrime(x: number): boolean; + + + /** + * isCoPrime function return the boolean in respect of the given number is co-prime or not. + * @param {Number} x first number for cheing co-prime or not. + * @param {Number} y second number for chieng co-prime or not. + * @returns return correspond boolean value, if both number are co-prime return `true`, else return `false`. + */ +export function isCoPrime(x: number, y: number): boolean; + + + /** + * krishnamurthy number is a number the sum of the all fectorial of the all dights is equal to the number itself. + * @param {Number} n a number for ching is krishnamurthy number or not. + * @returns return correspond boolean vlaue, if the number is krishnamurthy number return `true` else return `false`. + * @example 145 => 1! + 4! + 5! = 1 + 24 + 120 = 145 + */ +export function isKishnamurthyNumber(n: number): boolean; + + + /** + * Average is a terms is define summetion of all the given point and divide by thers numbers of count. + * @param {Number[]} arr A sequese of value for conting the avarage. + * @returns return appropriate `avarage` of the all terms. + * @example [1, 2, 3, 4, 5] => 15 / 5 = 3 + */ +export function avg(arr: number[]): number; + + + /** + * mod is define as the absulute value , without the signe. + * @param {Number} n a number with a sign or without a sign. + * @returns return the absolute value of the given number. + * @description `0 <= mod (all the real numbers.)` + */ +export function mod(n: number): number; + + + /** + * Count the number of work with the help of separetor. + * @param {String} str a string vlaue or paragraph. + * @param {String} separetor a value for separation. + * @returns return a work count with the help of separetor. + * @example workCount('This is normal string', ' ') => 4 + */ +export function wordCount(str: string, separetor: string): number; + + + /** + * A leap year is a calendar year that contains an additional day check the given year leap year or not. + * @param {Number} year value for check leap year. + * @returns return boolean vlaue, if the year is leep-year return `true`, else `false`. + */ +export function isLeap(year: number): boolean; + + + /** + * LCM - Least Comman multiple, find least common multiple of integers a and b + * @param {Number} a first number for operation + * @param {Number} b second number for operation + * @returns return the `lcm` of the number. + */ +export function lcm(a: number, b: number): number; + + + /** + * HCF - Highest Common Factor of the given numbers. + * @param {Number} a first number for operation. + * @param {Number} b second number for operation. + * @returns return the `gcd` of the number. + */ +export function hcf(a: number, b: number): number; + + + /** + * ASCII Code of the character. + * @param {String | CharacterData} ch a valid character + * @returns return `ascii code` of the given character + * @example ascii('A') => 65 + */ +export function ascii(ch: string | CharacterData): number; + + + /** + * Reverse the given string. + * @param {String} str a string vlaue. + * @returns return the reverse of the given string. + * @example reverse('ABC') => 'CBA' + */ +export function reverse(str: string): string; + + + /** + * The capitalize method converts any string in capitalize form for also known as title case form. + * @param {String} str + * @returns return capitalize string. + * @example capitalize('javascript') => 'Javascript' + */ +export function capitalize(str: string): string; + + + /** + * Return count of the substring in the string. + * @param {String} str input string. + * @param {String} seq input character or substring. + * @returns substring count. + */ +export function count(str: string, seq: string): number; + + + /** + * Palindrome - A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward check string or numebr is palindrome or not. + * @param {String} str string value for chacking. + * @returns return correspond boolean value, if the string is palindrom return `true`, else return `false`. + * @example isPalindrome('AABAA') => true + */ +export function isPalindrome(str: string): boolean; + + + /** + * permutation - get all the permutation of a given string. + * @param {String} str a string value or a paragraph. + * @returns {String[]} return all `permutation` of the string. + */ +export function permutation(str: string): string[]; + + + /** + * alternative string arrangement. + * @param {String} st1 first string vlaue + * @param {String} st2 second string value. + * @returns return a `alternative arranged string`. + * @example alternativeStringArrange('ABCD', 'XY') => 'AXBYCD' + */ +export function alternativeStringArrange(st1: string, st2: string): string; + + + /** + * indian phone number Validator. + * @param {String} str a phone number in form of string + * @returns check the number is true if `indian number`, else return flase. + */ +export function phoneValidator(str: string): boolean; + + + /** + * Indian phone number extractor. + * @param {String} str a paragraph for extracting a indain number. + * @returns return a indian number string if present. + */ +export function phoneExtractor(str: string): string; + + + /** + * Use for check the given string are alphanumeric or not. + * @param {String} str string for checking. + * @returns return boolean, true if alpahnumeric else return false. + */ +export function isAlNum(str: string): boolean; + + + /** + * Use for check the given stirn is alpha or not. + * @param {String} str string for checking. + * @returns return boolean, true if the string is alpha else return false. + */ +export function isAlpha(str: string): boolean; + + + /** + * Number To ASCII code. + * @param {Number} num for find the character. + * @returns return correspond string character of the number. + * @example numToAscii(65) => 'A' + */ +export function numToAscii(num: number): string; + + + /** + * This function check the givent string is all decimal characters or not. + * @param {String} str string for chacking. + * @returns return true if the string is decimal else return false. + */ +export function isDecimal(str: string): boolean; + + + /** + * This method check the given string in lower case or not. + * @param {String} str string value for checking. + * @returns return true if the string in lower case, else return false. + */ +export function isLower(str: string): boolean; + + + /** + * This method check the given string in upper case or not. + * @param {String} str string value for checking. + * @returns return true if the string in upper case, else return false. + */ +export function isUpper(str: string): boolean; + + + /** + * This method is used for the given string is only contain spaces. + * @param {String} str string for checking. + * @returns return true if the string is only space, else return false. + */ +export function isSpace(str: string): boolean; + + + /** + * This method is used for check the given string is in title form or not. + * @param {String} str string vlaue for checking. + * @returns return true, if given string in title case, else return false. + */ +export function isTitle(str: string): boolean; + + + /** + * The token method generates and returns a unique token in string format, every time you run without any arguments. + * @returns return a unique token every time to run. + */ +export function token(): string; + + + /** + * + * @param {Number} min a minimum range + * @param {Number} max a maximum range + * @returns return `random` vlaue between min to max. + */ +export function randomInt(min: number, max: number): number; + + + /** + * Use to find the remainder or modulo division. + * @param {Number} divident + * @param {Number} devisor + * @returns `Number` return numeric value of the remainder. + */ +export function remainder(divident: number, devisor: number): number; + + + /** + * Check fibonacci number : Returns true if n is a Fibinacci Number, else false + * @param {Number} num number for check the are fibonacci or not. + * @returns `Boolean` true if the number is fibonacci, else return false. + */ +export function isFibonacci(num: number): boolean; + + + /** + * The max method returns the maximum value from the given array. + * @param {Number[]} arr Array or list + * @returns {Number} maximum value form array. + */ +export function max(arr: number[]): number; + + + /** + * The min method returns the minimum value from the given array. + * @param {Number[]} arr Array or list + * @returns {Number} minimum value form array. + */ +export function min(arr: number[]): number; + + + /** + * The getPowerset method calculates all subset of the given set and return it, also known as powerset. + * @param {Array} set A set array. + * @returns {Array>} `Powerset` Returns the powerset of the given set. + */ +export function getPowerset(set: Array): Array>; + + + /** + * + * @param {number} originalCost Gross Price + * @param {number} gst gst percentage + * @returns {object} {netCost: Total_production_cost, tex: Tex} + */ +export function getGST(originalCost: number, gst: number): object; diff --git a/src/matrix/matrix.d.ts b/src/matrix/matrix.d.ts new file mode 100644 index 0000000..7e9c69c --- /dev/null +++ b/src/matrix/matrix.d.ts @@ -0,0 +1,36 @@ +/** + * Addition of two matrix is the result of adding the corresponding elements of two matrices. + * @param {Number[][]} mat1 A first matrix for addition. + * @param {Number[][]} mat2 A second matrix for addition. + * @returns {Number[][]} Addition of the matrix. + * @example matAdd([[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]) => [[2,4,6],[8,10,12]] + */ +export function matAdd(mat1: number[][], mat2: number[][]): number[][]; + + + /** + * Subtraction of two matrix is the result of subtracting the corresponding elements of two matrices. + * @param {Number[][]} mat1 A first matrix for subtraction. + * @param {Number[][]} mat2 A second matrix for subtraction. + * @returns {Number[][]} Subtraction of the matrix. + * @example matSub([[1,2,3],[4,5,6]],[[1,2,3],[4,5,6]]) => [[0,0,0],[0,0,0]] + */ +export function matSub(mat1: number[][], mat2: number[][]): number[][]; + + + /** + * The spiral print of a matrix is the order in which the elements are printed in a square matrix in a spiral order. + * @param {Number[][]} mat1 A matrix for spiral print. + * @returns {String} Spiral print of the matrix. + * @example matSpiralPrint([[1,2,3],[4,5,6],[7,8,9]]) => "1 2 3 6 9 8 7 4 5" + */ +export function matSpiralPrint(mat1: number[][]): string; + + + /** + * The transpose of a matrix is the matrix that results from exchanging the rows and columns of the original matrix. + * @param {Number[][]} mat A matrix for transpose. + * @returns {Number[][]} Transpose of the matrix. + * @example matTrans([[1,2,3],[4,5,6]]) => [[1,4],[2,5],[3,6]] + */ +export function matTrans(mat: number[][]): number[][]; diff --git a/src/number/number.d.ts b/src/number/number.d.ts new file mode 100644 index 0000000..1b2dfd6 --- /dev/null +++ b/src/number/number.d.ts @@ -0,0 +1,94 @@ +/** + * The hacToDec methods return hexadecimal to decimal numbers. + * @param {String} hex Hex value for conversion. + * @returns {Number} It returned a hex equivalent decimal value. + */ +export function hexToDec(hex: string): number; + + + /** + * The hacToOct methods return hexadecimal to Octal numbers. + * @param {String} hex Hex value for conversion. + * @returns {String} It returned a hex equivalent ocatal value. + */ +export function hexToOct(hex: string): string; + + + /** + * The hacToBin methods return hexadecimal to binary numbers. + * @param {String} hex Hex value for conversion. + * @returns {String} It returned a hex equivalent binary value. + */ +export function hexToBin(hex: string): string; + + + /** + * The decToHex methods return decimal to hexadecimal numbers. + * @param {Number} dec Dec value for conversion. + * @returns {String} It returned a dec equivalent hexadecimal value. + */ +export function decToHex(dec: number): string; + + + /** + * The decToOct methods return decimal to Octal numbers. + * @param {Number} dec Dec value for conversion. + * @returns {String} It returned a dec equivalent octal value. + */ +export function decToOct(dec: number): string; + + + /** + * The decToBin methods return decimal to binary numbers. + * @param {Number} dec Dec value for conversion. + * @returns {String} It returned a dec equivalent binary value. + */ +export function decToBin(dec: number): string; + + + /** + * The octToHex methods return octal to hexadecimal numbers. + * @param {String} oct Oct value for conversion. + * @returns {String} It returned a oct equivalent hexadecimal value. + */ +export function octToHex(oct: string): string; + + + /** + * The octToBin methods return octal to decimal numbers. + * @param {String} oct Oct value for conversion. + * @returns {Number} It returned a oct equivalent decimal value. + */ +export function octToDec(oct: string): number; + + + /** + * The octToBin methods return octal to binary numbers. + * @param {String} oct Oct value for conversion. + * @returns {String} It returned a oct equivalent binary value. + */ +export function octToBin(oct: string): string; + + + /** + * The binToHex methods return binary to hexadecimal numbers. + * @param {String} bin Binary value for conversion. + * @returns {String} It returned a binary equivalent hexadecimal value. + */ +export function binToHex(bin: string): string; + + + /** + * The binToDec methods return binary to decimal numbers. + * @param {String} bin Binary value for conversion. + * @returns {Number} It returned a binary equivalent decimal value. + */ +export function binToDec(bin: string): number; + + + /** + * The binToOct methods return binary to octal numbers. + * @param {String} bin Binary value for conversion. + * @returns {String} It returned a binary equivalent octal value. + */ +export function binToOct(bin: string): string; diff --git a/src/time/time.d.ts b/src/time/time.d.ts new file mode 100644 index 0000000..90600b0 --- /dev/null +++ b/src/time/time.d.ts @@ -0,0 +1,90 @@ +export function nsToUs(ns: any): number; +export function nsToMs(ns: any): number; +export function nsToSc(ns: any): number; +export function nsToMi(ns: any): number; +export function nsToHr(ns: any): number; +export function nsToDd(ns: any): number; +export function nsToWk(ns: any): number; +export function nsToMm(ns: any): number; +export function nsToYy(ns: any): number; +export function usToNs(us: any): number; +export function usToMs(us: any): number; +export function usToSc(us: any): number; +export function usToMi(us: any): number; +export function usToHr(us: any): number; +export function usToDd(us: any): number; +export function usToWk(us: any): number; +export function usToMm(us: any): number; +export function usToYy(us: any): number; +export function msToNs(ms: any): number; +export function msToUs(ms: any): number; +export function msToSc(ms: any): number; +export function msToMi(ms: any): number; +export function msToHr(ms: any): number; +export function msToDd(ms: any): number; +export function msToWk(ms: any): number; +export function msToMm(ms: any): number; +export function msToYy(ms: any): number; +export function scToNs(sc: any): number; +export function scToUs(sc: any): number; +export function scToMs(sc: any): number; +export function scToMi(sc: any): number; +export function scToHr(sc: any): number; +export function scToDd(sc: any): number; +export function scToWk(sc: any): number; +export function scToMm(sc: any): number; +export function scToYy(sc: any): number; +export function miToNs(mi: any): number; +export function miToUs(mi: any): number; +export function miToMs(mi: any): number; +export function miToSc(mi: any): number; +export function miToHr(mi: any): number; +export function miToDd(mi: any): number; +export function miToWk(mi: any): number; +export function miToMm(mi: any): number; +export function miToYy(mi: any): number; +export function hrToNs(hr: any): number; +export function hrToUs(hr: any): number; +export function hrToMs(hr: any): number; +export function hrToSc(hr: any): number; +export function hrToMi(hr: any): number; +export function hrToDd(hr: any): number; +export function hrToWk(hr: any): number; +export function hrToMm(hr: any): number; +export function hrToYy(hr: any): number; +export function ddToNs(dd: any): number; +export function ddToUs(dd: any): number; +export function ddToMs(dd: any): number; +export function ddToSc(dd: any): number; +export function ddToMi(dd: any): number; +export function ddToHr(dd: any): number; +export function ddToWk(dd: any): number; +export function ddToMm(dd: any): number; +export function ddToYy(dd: any): number; +export function wkToNs(wk: any): number; +export function wkToUs(wk: any): number; +export function wkToMs(wk: any): number; +export function wkToSc(wk: any): number; +export function wkToMi(wk: any): number; +export function wkToHr(wk: any): number; +export function wkToDd(wk: any): number; +export function wkToMm(wk: any): number; +export function wkToYy(wk: any): number; +export function mmToNs(mm: any): number; +export function mmToUs(mm: any): number; +export function mmToMs(mm: any): number; +export function mmToSc(mm: any): number; +export function mmToMi(mm: any): number; +export function mmToHr(mm: any): number; +export function mmToDd(mm: any): number; +export function mmToWk(mm: any): number; +export function mmToYy(mm: any): number; +export function yyToNs(yy: any): number; +export function yyToUs(yy: any): number; +export function yyToMs(yy: any): number; +export function yyToSc(yy: any): number; +export function yyToMi(yy: any): number; +export function yyToHr(yy: any): number; +export function yyToDd(yy: any): number; +export function yyToWk(yy: any): number; +export function yyToMm(yy: any): number; diff --git a/src/units/area/area.d.ts b/src/units/area/area.d.ts new file mode 100644 index 0000000..258acca --- /dev/null +++ b/src/units/area/area.d.ts @@ -0,0 +1,42 @@ +export function sqKmToSqMe(sqkm: any): number; +export function sqKmToSqYd(sqkm: any): number; +export function sqKmToSqFt(sqkm: any): number; +export function sqKmToSqIn(sqkm: any): number; +export function sqKmToHect(sqkm: any): number; +export function sqKmToAcre(sqkm: any): number; +export function sqMeToSqKm(sqme: any): number; +export function sqMeToSqYd(sqme: any): number; +export function sqMeToSqFt(sqme: any): number; +export function sqMeToSqIn(sqme: any): number; +export function sqMeToHect(sqme: any): number; +export function sqMeToAcre(sqme: any): number; +export function sqYdToSqKm(sqyd: any): number; +export function sqYdToSqMe(sqyd: any): number; +export function sqYdToSqFt(sqyd: any): number; +export function sqYdToSqIn(sqyd: any): number; +export function sqYdToHect(sqyd: any): number; +export function sqYdToAcre(sqyd: any): number; +export function sqFtToSqKm(sqft: any): number; +export function sqFtToSqMe(sqft: any): number; +export function sqFtToSqYd(sqft: any): number; +export function sqFtToSqIn(sqft: any): number; +export function sqFtToHect(sqft: any): number; +export function sqFtToAcre(sqft: any): number; +export function sqInToSqKm(sqin: any): number; +export function sqInToSqMe(sqin: any): number; +export function sqInToSqYd(sqin: any): number; +export function sqInToSqFt(sqin: any): number; +export function sqInToHect(sqin: any): number; +export function sqInToAcre(sqin: any): number; +export function hectToSqKm(hect: any): number; +export function hectToSqMe(hect: any): number; +export function hectToSqYd(hect: any): number; +export function hectToSqFt(hect: any): number; +export function hectToSqIn(hect: any): number; +export function hectToAcre(hect: any): number; +export function acreToSqKm(acre: any): number; +export function acreToSqMe(acre: any): number; +export function acreToSqYd(acre: any): number; +export function acreToSqFt(acre: any): number; +export function acreToSqIn(acre: any): number; +export function acreToHect(acre: any): number; diff --git a/src/units/digital_storage/digital_storage.d.ts b/src/units/digital_storage/digital_storage.d.ts new file mode 100644 index 0000000..3c4a8e5 --- /dev/null +++ b/src/units/digital_storage/digital_storage.d.ts @@ -0,0 +1,42 @@ +export function bitToByte(bit: any): number; +export function bitToKb(bit: any): number; +export function bitToMb(bit: any): number; +export function bitToGb(bit: any): number; +export function bitToTb(bit: any): number; +export function bitToPb(bit: any): number; +export function byteToBit(byte: any): number; +export function byteToKb(byte: any): number; +export function byteToMb(byte: any): number; +export function byteToGb(byte: any): number; +export function byteToTb(byte: any): number; +export function byteToPb(byte: any): number; +export function kbToBit(kilobyte: any): number; +export function kbToByte(kilobyte: any): number; +export function kbToMb(kilobyte: any): number; +export function kbToGb(kilobyte: any): number; +export function kbToTb(kilobyte: any): number; +export function kbToPb(kilobyte: any): number; +export function mbToBit(mb: any): number; +export function mbToByte(mb: any): number; +export function mbToKb(mb: any): number; +export function mbToGb(mb: any): number; +export function mbToTb(mb: any): number; +export function mbToPb(mb: any): number; +export function gbToBit(gb: any): number; +export function gbToByte(gb: any): number; +export function gbToKb(gb: any): number; +export function gbToMb(gb: any): number; +export function gbToTb(gb: any): number; +export function gbToPb(gb: any): number; +export function tbToBit(tb: any): number; +export function tbToByte(tb: any): number; +export function tbToKb(tb: any): number; +export function tbToMb(tb: any): number; +export function tbToGb(tb: any): number; +export function tbToPb(tb: any): number; +export function pbToBit(pb: any): number; +export function pbToByte(pb: any): number; +export function pbToKb(pb: any): number; +export function pbToMb(pb: any): number; +export function pbToGb(pb: any): number; +export function pbToTb(pb: any): number; \ No newline at end of file diff --git a/src/units/length/length.d.ts b/src/units/length/length.d.ts new file mode 100644 index 0000000..b0d4675 --- /dev/null +++ b/src/units/length/length.d.ts @@ -0,0 +1,72 @@ +export function kmToMe(km: any): number; +export function kmToCm(km: any): number; +export function kmToMm(km: any): number; +export function kmToUm(km: any): number; +export function kmToNm(km: any): number; +export function kmToYd(km: any): number; +export function kmToFt(km: any): number; +export function kmToIn(km: any): number; +export function meToKm(me: any): number; +export function meToCm(me: any): number; +export function meToMm(me: any): number; +export function meToUm(me: any): number; +export function meToNm(me: any): number; +export function meToYd(me: any): number; +export function meToFt(me: any): number; +export function meToIn(me: any): number; +export function cmToKm(cm: any): number; +export function cmToMe(cm: any): number; +export function cmToMm(cm: any): number; +export function cmToUm(cm: any): number; +export function cmToNm(cm: any): number; +export function cmToYd(cm: any): number; +export function cmToFt(cm: any): number; +export function cmToIn(cm: any): number; +export function mmToKm(mm: any): number; +export function mmToMe(mm: any): number; +export function mmToCm(mm: any): number; +export function mmToUm(mm: any): number; +export function mmToNm(mm: any): number; +export function mmToYd(mm: any): number; +export function mmToFt(mm: any): number; +export function mmToIn(mm: any): number; +export function umToKm(um: any): number; +export function umToMe(um: any): number; +export function umToCm(um: any): number; +export function umToMm(um: any): number; +export function umToNm(um: any): number; +export function umToYd(um: any): number; +export function umToFt(um: any): number; +export function umToIn(um: any): number; +export function nmToKm(nm: any): number; +export function nmToMe(nm: any): number; +export function nmToCm(nm: any): number; +export function nmToMm(nm: any): number; +export function nmToUm(nm: any): number; +export function nmToYd(nm: any): number; +export function nmToFt(nm: any): number; +export function nmToIn(nm: any): number; +export function ydToKm(yd: any): number; +export function ydToMe(yd: any): number; +export function ydToCm(yd: any): number; +export function ydToMm(yd: any): number; +export function ydToUm(yd: any): number; +export function ydToNm(yd: any): number; +export function ydToFt(yd: any): number; +export function ydToIn(yd: any): number; +export function ftToKm(ft: any): number; +export function ftToMe(ft: any): number; +export function ftToCm(ft: any): number; +export function ftToMm(ft: any): number; +export function ftToUm(ft: any): number; +export function ftToNm(ft: any): number; +export function ftToYd(ft: any): number; +export function ftToIn(ft: any): number; +export function inToKm(inc: any): number; +export function inToMe(inc: any): number; +export function inToCm(inc: any): number; +export function inToMm(inc: any): number; +export function inToUm(inc: any): number; +export function inToNm(inc: any): number; +export function inToYd(inc: any): number; +export function inToFt(inc: any): number; \ No newline at end of file diff --git a/src/units/temperature/temperature.d.ts b/src/units/temperature/temperature.d.ts new file mode 100644 index 0000000..1bef0e1 --- /dev/null +++ b/src/units/temperature/temperature.d.ts @@ -0,0 +1,6 @@ +export function celToFah(c: any): number; +export function celToKel(c: any): any; +export function fahToCel(f: any): number; +export function fahToKel(f: any): number; +export function kelToCel(k: any): number; +export function kelToFah(k: any): number; \ No newline at end of file diff --git a/src/utils/utils.d.ts b/src/utils/utils.d.ts new file mode 100644 index 0000000..08db178 --- /dev/null +++ b/src/utils/utils.d.ts @@ -0,0 +1,139 @@ +/** + * Take a date string and return a week day name of the given date. + * @param {String} date input date string + * @returns {String} `weekday` String day name + */ +export function dateToDay(date: string): string; + + + /** + * Take a date string and return a string withe year, month day vlaues. + * @param {String} date date string + * @returns {String} a string with formte. + */ +export function dobToAge(date: string): string; + + + /** + * Extract the key word from given string and return it. + * @param {String} str input string. + * @returns {String[]} return a string array of keywords. + */ +export function keywordExtractor(str: string): string[]; + + + /** + * If the word are contain special charector return true, else return false. + * @param {String} word a input string + * @returns {Boolean} return true false. + */ +export function contatinSpecial(word: string): boolean; + + + /** + * If the string contain keyword return true, else return false. + * @param {String} str input string as a test string. + * @param {String} keyword keyword for testing. + * @returns return true false. + */ +export function isKeywordExists(str: string, keyword: string): boolean; + + + /** + * CheckCamelCase method returns true if the string in camelCase, else return the false. + * @param {String} varName the name of the variable to check. + * @returns `Boolean` return true if the string is in camelCase, else return false. + */ +export function checkCamelCase(varName: string): boolean | TypeError; + + + /** + * CheckFlatCase method returns true if the string in flatcase, else return the false. + * @param {String} varname the name of the variable to check. + * @returns `Boolean` return true if the string is in flatcase, else return false. + */ +export function checkFlatCase(varname: string): boolean | TypeError; + + + /** + * CheckKebabCase method returns true if the string in kebab-case, else return the false. + * @param {String} varName the name of the variable to check. + * @returns `Boolean` return true if the string is in kebab-case, else return false. + */ +export function checkKebabCase(varName: string): boolean | TypeError; + + + /** + * CheckPascalCase method returns true if the string in PascalCase, else return the false. + * @param {String} VarName the name of the variable to check. + * @returns `Boolean` return true if the string is in PascalCase, else return false. + */ +export function checkPascalCase(VarName: string): boolean | TypeError; + + + /** + * CheckSnakeCase method returns true if the string in snake_case, else return the false. + * @param {String} varName the name of the variable to check. + * @returns `Boolean` return true if the string is in snake_case, else return false. + */ +export function checkSnakeCase(varName: string): boolean | TypeError; + + + /** + * URLShortener method converts any numeric id to a unique string + * @param {Number} id input id. + * @returns `String` Shorter or tiny id(url). + */ +export function URLShortener(id: number): string | TypeError; + + + /** + * railwayTimeConversion method converts normalized time string to Railway time string. + * @param {String} timeString Normalized time string Input Formate -> 07:05:45PM. + * @returns {String} Railway time string Output Fromate -> 19:05:45. + */ +export function railwayTimeConversion(timeString: string): string; + + + /** + * Sort the list of values, partition in place method O(nlogn). + * @param {Number[]} arr list of values. + * @param {Boolean} reverse if the reverse value is true the sort in ascending order else descending, default is true. + * @returns {Number[]} sorted list of values. + */ +export function sort(arr: number[], reverse?: boolean): number[]; + + + /** + * ext method return the file extention. + * @param {String} filename full filename with extention. + * @returns return only the extention value. + * @example mypicture.jpg => .jpg + */ +export function ext(filename: string): string; + + + /** + * Convert the lower or upper case string to the title case string. + * @param {String} lower lower or upper case string + * @returns return title string + * @example title('name') => 'Name' + */ +export function title(lower: string): string; + + + /** + * The timeDelta method is used for finding the difference between the two + * dates, if the difference is not valid the return false. + * @param {String} data1 data1 are previous data in "Mmm dd, yyyy Hh:Mm:Ss" format + * @param {String} data2 data2 are previous data in "Mmm dd, yyyy Hh:Mm:Ss" format + * @returns They return an object who contained days, hours, minutes, seconds delta values. + * @example dateDelta("Dec 20, 2021 12:00:00", "Dec 25, 2021 12:00:00") => + * { days: 5, hours: 0, minutes: 0, seconds: 0 } + */ +export function dateDelta(data1: string, data2: string): false | { + days: number; + hours: number; + minutes: number; + seconds: number; +}; \ No newline at end of file