percent-normalizer
Version:
A small converter library to normalize from/to percents
29 lines • 1.18 kB
TypeScript
export interface PercentNormalizerOption {
/** The max top range border */
topRangeBorder: number;
/** The min bottom range border */
bottomRangeBorder: number;
/** The original value */
value: number;
/** Returns the greatest integer, default false */
returnsInteger?: boolean;
/** The percents system top range, as default it's 100 */
percentsTopRangeBorder?: number;
/** The percents system bottom range, as default it's 0 */
percentsBottomRangeBorder?: number;
}
/**
* Normalize value from number range to presents system.
* For example, the 150 in the 100:200 range is 50%
* @param toPercentNormalizerOption The normalization properties
* @returns The normalized value
*/
export declare function normalizeToPercents(toPercentNormalizerOption: PercentNormalizerOption): number;
/**
* Normalize percents to other range system.
* For example, the 50% is 150 in the 100:200 range
* @param toPercentNormalizerOption The normalization properties
* @returns The normalized value
*/
export declare function normalizeFromPercents(fromPercentNormalizerOption: PercentNormalizerOption): number;
//# sourceMappingURL=index.d.ts.map