You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
329 B
11 lines
329 B
// @flow
|
|
import { max as mathMax, min as mathMin } from './math';
|
|
|
|
export function within(min: number, value: number, max: number): number {
|
|
return mathMax(min, mathMin(value, max));
|
|
}
|
|
|
|
export function withinMaxClamp(min: number, value: number, max: number) {
|
|
const v = within(min, value, max);
|
|
return v > max ? max : v;
|
|
}
|