diff options
| author | Christian Cleberg <[email protected]> | 2026-04-20 16:57:40 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-20 16:57:40 -0500 |
| commit | 2e90ee4ceca73d5126118920b486149cb227c4e9 (patch) | |
| tree | 32c726ba864f3e88e018452df3571f31bb518db0 /DomainDig/DomainDiffService.swift | |
| parent | 9999f876feb9a2d419a79ad601f78053c44d44f8 (diff) | |
| download | domain-dig-2e90ee4ceca73d5126118920b486149cb227c4e9.tar.gz domain-dig-2e90ee4ceca73d5126118920b486149cb227c4e9.tar.bz2 domain-dig-2e90ee4ceca73d5126118920b486149cb227c4e9.zip | |
feat(v2.1.0): add bulk workflows, CSV export, and filtering
Diffstat (limited to 'DomainDig/DomainDiffService.swift')
| -rw-r--r-- | DomainDig/DomainDiffService.swift | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/DomainDig/DomainDiffService.swift b/DomainDig/DomainDiffService.swift index fa3d8b5..65ea5a7 100644 --- a/DomainDig/DomainDiffService.swift +++ b/DomainDig/DomainDiffService.swift @@ -13,12 +13,20 @@ struct DomainDiffItem: Identifiable, Equatable { let changeType: DiffChangeType let oldValue: String? let newValue: String? + + var hasChanges: Bool { + changeType != .unchanged + } } struct DomainDiffSection: Identifiable, Equatable { let id = UUID() let title: String let items: [DomainDiffItem] + + var hasChanges: Bool { + items.contains(where: \.hasChanges) + } } enum DomainDiffService { @@ -105,13 +113,15 @@ enum DomainDiffService { private static func compare(label: String, oldValue: String?, newValue: String?) -> DomainDiffItem? { let oldValue = normalized(oldValue) let newValue = normalized(newValue) + let normalizedOldValue = comparisonValue(oldValue) + let normalizedNewValue = comparisonValue(newValue) guard oldValue != nil || newValue != nil else { return nil } let changeType: DiffChangeType - switch (oldValue, newValue) { + switch (normalizedOldValue, normalizedNewValue) { case let (old?, new?) where old == new: changeType = .unchanged case (nil, _?): @@ -129,7 +139,11 @@ enum DomainDiffService { guard let value = value?.trimmingCharacters(in: .whitespacesAndNewlines), !value.isEmpty else { return nil } - return value.lowercased() + return value + } + + private static func comparisonValue(_ value: String?) -> String? { + value?.lowercased() } private static func availabilityLabel(_ status: DomainAvailabilityStatus?) -> String? { |
