Skip to content

Commit

Permalink
use Dictionary(grouping:by:) init to simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tejassharma96 committed Nov 19, 2024
1 parent 8a9d798 commit 8016dc6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/Yams/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ private extension Parser {
}

private func checkDuplicates(mappingKeys: [Node]) throws {
let duplicates: [Node: [Node]] = Dictionary(grouping: mappingKeys) { $0 }
.filter { $1.count > 1 }
let duplicates: [Node: [Node]] = Dictionary(grouping: mappingKeys) { $0 }.filter { $1.count > 1 }
guard duplicates.isEmpty else {
throw YamlError.duplicatedKeysInMapping(duplicates: duplicates, yaml: yaml)
}
Expand Down

0 comments on commit 8016dc6

Please sign in to comment.