While the JSValueCompatible APIs are failable, the underlying conversion of calling SignedInteger.init(_:) and UnsignedInteger.init(_:)directly can crash at runtime if:
double.isNan
!double.isFinite
double > .max || double < .min
Ideally, none of these would crash and return nil instead:
While the
JSValueCompatible
APIs are failable, the underlying conversion of callingSignedInteger.init(_:)
andUnsignedInteger.init(_:)
directly can crash at runtime if:double.isNan
!double.isFinite
double > .max || double < .min
Ideally, none of these would crash and return
nil
instead:Int.construct(from: JSValue.number(.infinity))
Int.construct(from: JSValue.number(.nan))
Int.construct(from: JSValue.number(numberGreaterThanIntMax)
Int.construct(from: JSValue.number(numberLessThanIntMin)