Is there a function to clip an array to a maximum value? e.g. set values in an arr