UNPKG

@alifd/meet-react

Version:

Fusion Mobile React UI System Component

21 lines 480 B
import { isNumber } from '../utils'; export function toNumber(num) { if (!isNumber(num)) { return num; } return Number(num); } export function clamp(value, min, max) { if (!isNumber(value)) { return value; } return value > max ? max : value < min ? min : value; } export function getDefaultValue(min, max, threshold) { if (min && min > -threshold) { return toNumber(min); } else if (max && max < threshold) { return toNumber(max); } return 0; }