Skip to content

Commit

Permalink
Accept suggested improvement
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Nowak <[email protected]>
  • Loading branch information
tonytw1 and andrew-nowak authored Dec 2, 2024
1 parent d294f9e commit 851926c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cropper/app/lib/CropSpecMetadata.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ trait CropSpecMetadata {
"height" -> dimensions.height,
"aspect-ratio" -> r)

val nonEmptyMetadata = metadata.filter {
case (_, None) => false
case _ => true
val flattenedMetadata = metadata.collect {
case (key, Some(value)) => key -> value.toString
case (key, value) if value != None => key -> value.toString
}

val flattenedMetadata = nonEmptyMetadata.collect {
case (key, Some(value)) => key -> value
case (key, value) => key -> value
}.view.mapValues(_.toString).toMap
flattenedMetadata

flattenedMetadata
}
Expand Down

0 comments on commit 851926c

Please sign in to comment.