
jsMain.js.core.ArrayLike.kt Maven / Gradle / Ivy
package js.core
external interface ArrayLike {
val length: Int
}
inline operator fun ArrayLike.get(
index: Int,
): T =
asDynamic()[index]
fun ArrayLike.asList(): List =
object : AbstractList() {
override val size: Int
get() = [email protected]
override fun get(index: Int): T =
when (index) {
in 0..lastIndex -> this@asList[index]
else -> throw IndexOutOfBoundsException("index $index is not in range [0..$lastIndex]")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy