Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ibinti #1806

Closed
wants to merge 15 commits into from

Create helper.kt

  • Loading branch information
ibinti committed Jan 10, 2020
commit 447645eea87558b9a9a3d4db389bf554e57b5c39
@@ -0,0 +1,24 @@
package kotorrent

external val require:dynamic = definedExternally
external val process:dynamic = definedExternally
fun new(type: dynamic, vararg args: dynamic): dynamic {
val argsArray = (listOf(null) + args).toTypedArray()
return js("new (Function.prototype.bind.apply(type, argsArray))")
}
val printjo = {jo:dynamic->val msg=kotlin.js.JSON.stringify(jo);println(msg)}
val kob = {
/*
wrapper to create a dynamic object
*/
val o:dynamic=object{}
o
}
val version_azureus = { version:String ->
version.replace(Regex("""\d*."""), { val x = "${it.value}".toFloat() % 100; "0$x".takeLast(2)}).take(4)
}
fun get_version_azureus(version:String):String {
return version.replace(Regex("""\d*."""), { val x = "${it.value}".toFloat() % 100; "0$x".takeLast(2)}).take(4)
}

val jstype = {t:Any->js("typeof t")}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.