♻️ Simplify max identifier length calculation

This commit is contained in:
Chris Araman 2021-04-27 15:31:35 -07:00
parent f0bf27a821
commit 0a506b1ebe
No known key found for this signature in database
GPG key ID: BB4499D9E11B61E0

View file

@ -19,11 +19,7 @@ struct AppListFormatter {
/// - Returns: Multiliune text outoutp.
static func format(products: [SoftwareProduct]) -> String {
// find longest appName for formatting, default 50
let maxLength =
products.map(\.appNameOrBbundleIdentifier)
.max(by: { $1.count > $0.count })?
.count
?? nameColumnMinWidth
let maxLength = products.map(\.appNameOrBbundleIdentifier.count).max() ?? nameColumnMinWidth
var output: String = ""