Skip to content

Commit

Permalink
♻️ Simplify max length calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-araman committed Jun 4, 2021
1 parent e7fbcff commit 2e49838
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Sources/MasKit/Formatters/SearchResultFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ struct SearchResultFormatter {
/// - Returns: Multiliune text outoutp.
static func format(results: [SearchResult], includePrice: Bool = false) -> String {
// find longest appName for formatting, default 50
let maxLength =
results.map(\.trackName).max(by: { $1.count > $0.count })?.count
?? 50

let maxLength = results.map(\.trackName.count).max() ?? 50
var output: String = ""

for result in results {
Expand Down

0 comments on commit 2e49838

Please sign in to comment.