Edoardo Luppi
08/12/2023, 3:31 PMif (!JsNumber.isSafeInteger(value)) {
throw IllegalArgumentException("Invalid number: $value")
}
Given an exported function like
fun writeInt(value: Int)
And being that in JS (or even TS) there is no guarantee the submitted number
is indeed an integer , what's the best path to take to ensure data correctness?turansky
08/12/2023, 5:59 PMEdoardo Luppi
08/12/2023, 10:46 PMnumber
, so a user can submit any kind.
But that check works perfectly for my needs.turansky
08/13/2023, 12:17 AMNumber.toInt()
+ check