The current proposal for flatten says "If depth was provided, then" - this means that .flatten() and .flatten(undefined) have different behavior.
Specifically, .flatten(undefined) would call FlattenIntoArray with NaN instead of Infinity, and thus NaN > 0 would immediately be false; whereas Infinity > 0 is true.
Generally the spec tries to avoid differentiating "absent" and undefined - I think this should change to "If depth is not undefined".
Note that #14's change makes it so that () and (undefined) have observably the same behavior, since NaN is an effective depth of 1 - but this still seems worth cleaning up in the spec.
The current proposal for
flatten
says "If depth was provided, then" - this means that.flatten()
and.flatten(undefined)
have different behavior.Specifically,
.flatten(undefined)
would callFlattenIntoArray
withNaN
instead ofInfinity
, and thusNaN > 0
would immediately befalse
; whereasInfinity > 0
istrue
.Generally the spec tries to avoid differentiating "absent" and
undefined
- I think this should change to "If depth is notundefined
".