Skip to content

Commit 6805f1d

Browse files
committed
fix: create JMESPATH flattenIfPossible functions for Lists
1 parent 15cde2a commit 6805f1d

File tree

1 file changed

+10
-0
lines changed
  • runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util

1 file changed

+10
-0
lines changed

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,20 @@ public fun Any?.type(): String = when (this) {
6666
else -> throw Exception("Undetected type for: $this")
6767
}
6868

69+
// Collection `flattenIfPossible`` functions
6970
@InternalApi
7071
@JvmName("noOpUnnestedCollection")
7172
public inline fun <reified T> Collection<T>.flattenIfPossible(): Collection<T> = this
7273

7374
@InternalApi
7475
@JvmName("flattenNestedCollection")
7576
public inline fun <reified T> Collection<Collection<T>>.flattenIfPossible(): Collection<T> = flatten()
77+
78+
// List `flattenIfPossible` functions
79+
@InternalApi
80+
@JvmName("noOpUnnestedCollection")
81+
public inline fun <reified T> List<T>.flattenIfPossible(): List<T> = this
82+
83+
@InternalApi
84+
@JvmName("flattenNestedCollection")
85+
public inline fun <reified T> List<List<T>>.flattenIfPossible(): List<T> = flatten()

0 commit comments

Comments
 (0)