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.
|
/// Subvalidations that expect an input type that matches the validation's `Support` type.
|
||||||
public static var safeSubvalidations: [AnyValidation.Type] {
|
public static var safeSubvalidations: [AnyValidation.Type] {
|
||||||
return self.subvalidations.compactMap { validation in
|
return self.subvalidations.filter { $0.type == Supported.self }
|
||||||
guard validation.type == Supported.self else { return nil }
|
|
||||||
return validation
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the currenct validation and any subvalidations that support the `Supported` type.
|
/// Runs the currenct validation and any subvalidations that support the `Supported` type.
|
||||||
|
|
Loading…
Reference in New Issue