Platform and version requirements: JS (1.1)
abstract operator fun get(propertyName: String): Any?

Calls to the function will be translated to indexing operation (square brackets) on the receiver with propertyName as the argument.

E.g. for next code:

fun test(j: Json, p: String) = j["prop"] + j.get(p)

will be generated:

function test(j, p) {
    return j["prop"] + j[p];

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.