@re621/zestyapi
Version:
Comprehensive JS wrapper for e621.net API
27 lines (26 loc) • 1.12 kB
TypeScript
export default class UtilMath {
/**
* Ensures that the first provided value is bigger than the second, but smaller than the third
* @param {number} cur Value being evaluated
* @param {number} min Minimum possible value
* @param {number} max Maximum possible value
* @returns {number} final result
*/
static clamp(cur: number, min: number, max: number): number;
/**
* Boolean version of `clamp()`.
* Returns true as long as the first value is bigger than the second, but smaller than the third
* @param {number} cur Value being evaluated
* @param {number} min Minimum possible value
* @param {number} max Maximum possible value
* @returns {boolean} `true` if the conditions match, `false` otherwise
*/
static between(cur: number, min: number, max: number): boolean;
/**
* Rounds the provided number to a specified decimal place
* @param {number} value Value being evaluated
* @param {number} decimal Decimal place
* @returns {number} Rounded number
*/
static round(value: number, decimal?: number): number;
}