We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 33f998f + ff4d25b commit b7af177Copy full SHA for b7af177
1 file changed
surf-api-core/surf-api-core/src/main/kotlin/dev/slne/surf/api/core/config/constraints/CollectionConstraintUtils.kt
@@ -0,0 +1,13 @@
1
+package dev.slne.surf.api.core.config.constraints
2
+
3
+import dev.slne.surf.api.core.config.type.StringOrDefault
4
5
+internal tailrec fun Any?.configSizeOrNull(): Int? = when (this) {
6
+ null -> null
7
+ is Collection<*> -> size
8
+ is Map<*, *> -> size
9
+ is Array<*> -> size
10
+ is CharSequence -> length
11
+ is StringOrDefault -> value?.configSizeOrNull()
12
+ else -> null
13
+}
0 commit comments