import max from '../max/index' ; import min from '../min/index' ; import type { Interval } from '../types' ; import requiredArgs from '../_lib/requiredArgs/index' ; name category summary description example param { Date | Number } date param { Interval } interval returns { Date } throws export default function clamp ( date , { start , end } ) { requiredArgs ( 2 , arguments ) ; return min ( [ max ( [ date , start ] ) , end ] ) ; }