diff --git a/Sources/Operators/SkipErrors.swift b/Sources/Operators/SkipErrors.swift new file mode 100644 index 0000000..41aadbe --- /dev/null +++ b/Sources/Operators/SkipErrors.swift @@ -0,0 +1,20 @@ +// +// SkipErrors.swift +// +// +// Created by Kristof Zelei on 2023. 06. 20.. +// Copyright © 2023. Supercharge Ltd. All rights reserved. +// + +#if canImport(Combine) +import Combine + +extension Publisher where Failure == Error { + public func skipErrors() -> AnyPublisher { + map { Optional($0) } + .replaceError(with: nil) + .compactMap { $0 } + .eraseToAnyPublisher() + } +} +#endif