UNPKG

ax-calculator

Version:
418 lines (398 loc) 12.4 kB
/** Returns exact values of a system of 2 equations @param equation1 - first equation @param equation2 - second equation **/ declare const SystemEquation: { double: (equation1: Array<number>, equation2: Array<number>) => string | { x: number | undefined; y: number | undefined; }; }; declare const Equations: { /** Example -> f1: x² + 7x + 6 = 0 Example -> f2: 3x² - 27 = 0 @description The parameters vary according to the formula @param a - For f1 -> 1, For f2 -> 3 @param b - For f1 -> 7, For f2 -> -27 @param c - For f1 -> 6, Do not place anything **/ secondDegree: (a: number, b: number, c: number) => string | number | { x1: string; x2: string; }; }; declare const BasicOperations: { /** Returns the sum of the numbers **/ sum: (...parameters: number[]) => object | string; /** Returns the substract of the numbers **/ substract: (...parameters: number[]) => any; /** Returns the product of the numbers */ product: (...parameters: number[]) => object | string; /** Returns the division by 2 numbers **/ division: (number1: number, number2: number) => string | number; /** Returns the remainder of a division by 2 numbers **/ module: (number1: number, number2: number) => string | number; /** Raise a number to a exponent **/ raiseTo: (number: number, exponent: number) => string | number; /** If you do not enter a root, you will get the square root by default. **/ root: (number: number, root?: number) => string | number; probability: (items: { [key: string]: number; }) => string; Chaining: { new (): { value: number; /** Place a number to start your chain of operations */ baseNumber(value: number): this; sum(value: number): any; multiply(value: number): any | "[x] You can't multiply with anything" | "[x] Multiply: Place a number"; substract(value: number): any | "[x] You can't substract with anything" | "[x] Substract Error: Place a number"; divide(value: number): any | "[x] You can't divide with anything" | "[x] Divide Error: Place a number"; }; }; }; declare const RuleOfThree: { /** @param type Can be direct or inverse **/ simple: (type: string, a: number, b: number, c: number, d: number) => number | string | undefined; }; declare const Percentage: { /** Example: What percentaje is 12 out of 30? @description Calculates the percentage of the total according to the value you give it @param number 12 @param total 30 **/ whatPercentageIs: (number: number, total: number) => string; /** Example: How much is 7% of 39? @description Calculates the percentage of a number or quantity. @param percentage 7% @param total 39 **/ percentageOf: (percentage: number, total: number) => string | number; /** Example: If 30% is 10, then 60% is... @description Calculates a percentage from another percentage. @param percentage1 30% @param value1 10 @param percentage2 60 **/ percentFromPercent: (percentage1: number, value1: number, percentage2: number) => string | number; /** Example: If 10% is 20, the total is... @description Calculate the total from a percentage @param percentage 10% @param value 20 **/ totalFromPercent: (percentage: number, value: number) => string | number; }; declare const Fractions: { sum: (numerator1: number, denominator1: number, numerator2: number, denominator2: number) => string; substract: (numerator1: number, denominator1: number, numerator2: number, denominator2: number) => string; product: (numerator1: number, denominator1: number, numerator2: number, denominator2: number) => string; division: (numerator1: number, denominator1: number, numerator2: number, denominator2: number) => string; /** @param top - Numerator @param bottom - Denominator **/ simplify: (top: number, bottom: number) => string; /** @param fraction **/ destructure: (fraction: string) => { top: string | undefined; bottom: string | undefined; }; }; declare const Base: { toBase: (number: number, base: number) => number | string; binaryToBase10: (number: number) => number | string; }; declare const LinearCongruences: { /** * @param range By default you find 'x' values between 0 and 10, you can change this value if you need * @description a = b mod module */ simple: (a: number, b: number, module: number, range?: number) => Array<number>; }; declare const ChemicalElements: { show: (param: string | number) => object | string | undefined; obtainByFamily: (type: string) => object | string; obtainByGroup: (group: string) => object | string; }; declare const Operations: { /** Returns the square root of the product of the sum of the squared sides of the triangle */ hypotenuse: (param1: number, param2: number) => string | number; /** Convert a number to Roman numerals @param num The number you are going to convert **/ /** - You have a simple log like log(b)a = c @param base The base of the log -> b @param argument The result of bᶜ -> a @param logarithm Also known as exponent -> c @return Return the missing value in the log, set null to the value you need to find **/ log: (base: number, argument: number, logarithm: number) => number | undefined; /** - Example -> C¹¹₇ - Returns the number of possible combinations @param top - 11 @param bottom - 7 **/ combinatorial: (top: number, bottom: number) => number | string; /** Returns the fibonacci series @param maxlength The number of values you wish to obtain @return Returns an array with the inserted values **/ fibonacci: (maxlength: number) => Array<number> | string; /** Returns the divisors of a number **/ divisors: (number: number) => number[] | string; /** Returns the factorial of a number **/ factorial: (number: number) => string | number; /** * 4!! is difference to (4!)! Returns the double factorial of a number **/ doubleFactorial: (number: number) => string | number; }; declare const Triangles: { angle30_60: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle45: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle37_53: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle16_74: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle14_76: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle15_75: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle50_40: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle8_82: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle70_20: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle35_55: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; angle36_54: () => { hypotenuse: string; opposite: string; adjacent: string; sin: string; cos: string; tan: string; }; }; declare const Validator: { /** @param {any} param **/ isNumber: (...param: Array<any>) => boolean | string; /** Return true if the number is even */ isEven: (number: number) => string | boolean; /** Return true if the number is odd */ isOdd: (number: number) => boolean | string; /** @param {any} param **/ isBoolean: (...param: Array<any>) => boolean; /** @param {any} param **/ isString: (...param: Array<any>) => boolean; /** @param {any} param **/ isObject: (param: any) => boolean; /** @param {any} param **/ isArray: (param: any) => boolean; /** @description this function returns true if the item you pass is undefined **/ isUndefined: (param: any) => boolean; /** @param {object[]} object **/ containsString: (object: Array<any>) => boolean | string | undefined; /** @param {object[]} object **/ containsNumber: (object: Array<any>) => boolean | string | undefined; /** @param { Array } object Put an array, this functions validate if this array contains objects. Remember that objects are differents from arrays **/ containsObject: (object: Array<any>) => boolean; /** @param { Array } object Put an array, this functions validate if this array contains others arrays **/ containsArray: (object: Array<any>) => boolean; }; declare function Config(props?: { language: string; history: boolean; globalMessage: string; PI: number; disabledTriangleConstants: boolean; }): { language: string; history: boolean; globalMessage: string; PI: number; disabledTriangleConstants: boolean; }; declare const Clock: { /** Display the time **/ time: (seconds?: boolean, spacing?: boolean) => string; /** @return {string} **/ date: (format?: string, optionalYear?: boolean) => string; calculateDaysBetweenDates: (begin: string, end: string) => string | number; }; declare const RegexValidator: { /** * @param capitalize If true, you allos capital letters * @param length You can put the min value and max value for the length * @returns The regex pattern that allows only letters */ onlyLetters: (object: { capitalize: boolean; allowSpacing: boolean; length: { minvalue: Number; maxvalue: Number; }; }) => RegExp; /** * @returns The regex pattern that allows only numbers */ onlyNumbers: (object: { length: { minvalue: Number; maxvalue: Number; }; }) => RegExp; /** * @param capitalize If true, you allos capital letters * @param allowSpacing allow white space * @returns The regex pattern that allows letters and numbers */ onlyLettersAndNumbers: (object: { capitalize: boolean; allowSpacing: boolean; }) => RegExp; /** * @param minvalue the min length * @param maxvalue the max length * @returns The regex pattern */ length: (object: { minvalue: Number; maxvalue: Number; }) => RegExp; /** * * @param lengths You can put more than one length * @returns The regex pattern */ implicitLength: (...lengths: Array<Number>) => RegExp; /** * * @param text The string you want coincidence * @returns The regex pattern * @example RegexValidator.coicidence('abc').test('Hello abc') // true */ coindicence: (...patterns: Array<String>) => RegExp; }; export { Base, BasicOperations, ChemicalElements, Clock, Config, Equations, Fractions, LinearCongruences, Operations, Percentage, RegexValidator, RuleOfThree, SystemEquation, Triangles, Validator };