UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

23 lines (22 loc) 1.01 kB
export declare const clamp: (value: number, min: number, max: number) => number; /** * Returns the quantity of real decimal places for a number, which excludes trailing zeros. * * Adapted from {@link https://stackoverflow.com/questions/10454518/javascript-how-to-retrieve-the-number-of-decimals-of-a-string-number}. * * @param decimal - decimal value * @param value * @returns {number} the amount of decimal places in a number */ export declare const decimalPlaces: (value: number | string) => number; export declare function getDecimals(value: number): number; export declare function remap(value: number, fromMin: number, fromMax: number, toMin: number, toMax: number): number; /** * Helper to determine if a value is close to the edge of a range within a threshold. * * @param value * @param range * @param threshold * @returns -1 if close to lower edge, 1 if close to upper edge, 0 otherwise. */ export declare function closeToRangeEdge(value: number, range: number, threshold: number): number;