coerceAtMost method

T coerceAtMost(
  1. T maximumValue
)

Ensures that this value is not greater than the specified maximumValue.

@return this value if it's less than or equal to the maximumValue or the maximumValue otherwise.

Implementation

T coerceAtMost(T maximumValue) => this > maximumValue ? maximumValue : this;