Skip to content

Commit

Permalink
add similarity operator
Browse files Browse the repository at this point in the history
  • Loading branch information
darinf committed Apr 6, 2024
1 parent b437bf2 commit 186b1d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/FirebaseAuth/FirebaseAuthError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,8 @@ extension AuthErrorCode {
self.init(rawValue: code.rawValue)
}
}

public func ~= (code: AuthErrorCode.Code, error: any Error) -> Bool {
guard let error = error as? AuthErrorCode else { return false }
return error.code == code
}
5 changes: 5 additions & 0 deletions Sources/FirebaseFirestore/FirestoreErrorCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ extension FirestoreErrorCode {
self.init(rawValue: code.rawValue)
}
}

public func ~= (code: FirestoreErrorCode.Code, error: any Error) -> Bool {
guard let error = error as? FirestoreErrorCode else { return false }
return error.code == code
}

0 comments on commit 186b1d0

Please sign in to comment.