Use .filter instead of .compactMap in Validation.safeSubvalidations property
This commit is contained in:
parent
f1058cfb6f
commit
7cf275eb06
|
@ -95,10 +95,7 @@ extension Validation {
|
|||
|
||||
/// Subvalidations that expect an input type that matches the validation's `Support` type.
|
||||
public static var safeSubvalidations: [AnyValidation.Type] {
|
||||
return self.subvalidations.compactMap { validation in
|
||||
guard validation.type == Supported.self else { return nil }
|
||||
return validation
|
||||
}
|
||||
return self.subvalidations.filter { $0.type == Supported.self }
|
||||
}
|
||||
|
||||
/// Runs the currenct validation and any subvalidations that support the `Supported` type.
|
||||
|
|
Loading…
Reference in New Issue