From my investigations, d3.min is supposed to work on any kind of orderable values, not only numbers. isNaN would only work numbers.
d3 was actually using == at some point. This commit introduced the x == x test:
Unlike
Math.minandMath.max, it doesn’t make sense to return negative or positive infinity ford3.minandd3.max; the D3 functions return the minimum value according to an arbitrary ordering, not by numeric value. Instead, the minimum or maximum of an empty array, or an array that contains only degenerate values, should always be undefined.
This commit changed x == x to x <= x (which was later again changed to x >= x):
In addition to
NaN, which is not equal to itself, you can have objects that are not orderable due to defined valueOf functions which return NaN. For example:var o = new Number(NaN);Here,
o == ois true, buto <= ois false. Therefore it was possible for d3.min, d3.max and d3.extent to observe these non-orderable values rather than ignore them as intended. The fix is to check!(o <= o)rather thano == o.