Skip to content

Commit 50d2d8e

Browse files
author
Oleg
committed
Add tailrec to function that gets json element by json pointer
1 parent 9426c46 commit 50d2d8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/commonMain/kotlin/smirnov/oleg/json/pointer/extensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fun JsonPointer.relative(other: JsonPointer): JsonPointer {
6161
return JsonPointer(otherValue.substringAfter(currentValue))
6262
}
6363

64-
fun JsonElement.at(pointer: JsonPointer): JsonElement? {
64+
tailrec fun JsonElement.at(pointer: JsonPointer): JsonElement? {
6565
return when (pointer) {
6666
is EmptyPointer -> this
6767
is SegmentPointer -> {

0 commit comments

Comments
 (0)