Any idea what should go in those extension functio...
# getting-started
s
Any idea what should go in those extension function?
d
sandeep: What array class are you using? If it’s a JsonArray containing strings for example, you would define it like
operator fun JsonArray.component1(): String { return this.get(0) }
and
operator fun JsonArray.component2(): String { return this.get(1) }
If your array uses generics then the signatures will be a little bit more complex obviously.
s
Oh I see what you mean, componentN goes for each item, where N is index
Yes I am using JsonArray
Thanks man!!
👍 1