Skip to content

Commit 6c1faf0

Browse files
committed
style(node): Remove one level of nesting a when case
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 55fee4b commit 6c1faf0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

plugins/package-managers/node/src/main/kotlin/PackageJson.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,14 @@ private object AuthorListSerializer : JsonTransformingSerializer<List<Author>>(s
185185
when (this) {
186186
is JsonObject -> listOf(this)
187187

188-
is JsonPrimitive -> {
189-
parseAuthorString(contentOrNull).mapNotNull { info ->
190-
when {
191-
info.name != null -> Author(checkNotNull(info.name), info.email, info.homepage)
192-
info.email == null -> null
193-
else -> Author(guessNameFromEmail(checkNotNull(info.email)), info.email, info.homepage)
194-
}
195-
}.map {
196-
JSON.encodeToJsonElement(it)
188+
is JsonPrimitive -> parseAuthorString(contentOrNull).mapNotNull { info ->
189+
when {
190+
info.name != null -> Author(checkNotNull(info.name), info.email, info.homepage)
191+
info.email == null -> null
192+
else -> Author(guessNameFromEmail(checkNotNull(info.email)), info.email, info.homepage)
197193
}
194+
}.map {
195+
JSON.encodeToJsonElement(it)
198196
}
199197

200198
else -> throw SerializationException("Unexpected JSON element.")

0 commit comments

Comments
 (0)