Kotlin 1.4.10 doesn’t support a number of Char functions like isDigit, isLetter, isLetterOrDigit on the javascript platform.
Until there’s no official support for these functions, is there a way to add these on my own?
An implementation like
fun Char.isDigit(): Boolean {
val c = this
return js("!isNaN(parseInt(c, 10))") as Boolean
}
would be OK for the time being, however I don’t how I could make this work. isDigit is defined for other platforms in package kotlin.text however if I try to put my implementation into kotlin.text the compiler complains that Only the Kotlin standard library is allowed to use the 'kotlin' package.
So, what could be the workaround if there is any?
Thanks!