min<T extends Comparable<Object>> function

T min<T extends Comparable<Object>>(
  1. T a,
  2. T b
)

Returns the lesser of two Comparable objects.

For num values, behaves identically to math.min.

If the arguments compare equal, then it is unspecified which of the two arguments is returned.

Implementation

T min<T extends Comparable<Object>>(T a, T b) {
  if (a is num) {
    return math.min(a, b as num) as T;
  }
  return (a <= b) ? a : b;
}