UNPKG

@janiscommerce/ui-native

Version:
21 lines (20 loc) 996 B
/** * @name getPercentage * @description return the percentage form a partial value and a total value, * rounded to the nearest integer * @param {number} value the partial value * @param {number} totalValue the total value * @returns {number|null} the percentage in the range 0-100, or null if receives an invalid param * @example getPercentage(45,100) // 45 * @example getPercentage(22,150) // 15 */ export declare const getPercentage: (value: number, totalValue: number) => number; /** * @name getBarColor * @description Devuelve una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto * considerando los diferentes umbrales (25, 50 y 75). * @returns {Function} - Una función que recibe un objeto con un campo "percentage" y devuelve el color de la barra correcto. * @example getBarColor(30) // '#FF8D10' (naranja) * @example getBarColor(90) // '#1DB779' (verde) */ export declare const getBarColor: (percentage: number) => string;