diff --git a/Sources/JSONAPI/Resource/Transformer.swift b/Sources/JSONAPI/Resource/Transformer.swift index c7aae56..203b9b5 100644 --- a/Sources/JSONAPI/Resource/Transformer.swift +++ b/Sources/JSONAPI/Resource/Transformer.swift @@ -7,12 +7,12 @@ /// A Transformer simply defines a static function that transforms a value. public protocol Transformer { - associatedtype From - associatedtype To + associatedtype From + associatedtype To /// Turn value of type `From` into a value of type `To` or /// throw an error on failure. - static func transform(_ value: From) throws -> To + static func transform(_ value: From) throws -> To } /// ReversibleTransformers define a function that reverses the transform @@ -20,13 +20,13 @@ public protocol Transformer { public protocol ReversibleTransformer: Transformer { /// Turn a value of type `To` into a value of type `From` or /// throw an error on failure. - static func reverse(_ value: To) throws -> From + static func reverse(_ value: To) throws -> From } /// The IdentityTransformer does not perform any transformation on a value. public enum IdentityTransformer: ReversibleTransformer { - public static func transform(_ value: T) throws -> T { return value } - public static func reverse(_ value: T) throws -> T { return value } + public static func transform(_ value: T) throws -> T { return value } + public static func reverse(_ value: T) throws -> T { return value } } // MARK: - Validator @@ -41,16 +41,16 @@ public protocol Validator: ReversibleTransformer where From == To { } extension Validator { - public static func reverse(_ value: To) throws -> To { - let _ = try transform(value) - return value - } + public static func reverse(_ value: To) throws -> To { + let _ = try transform(value) + return value + } /// Validate the given value and then return it if valid. /// throws an erro if invalid. /// - returns: The same value passed in, if it was valid. - public static func validate(_ value: To) throws -> To { - let _ = try transform(value) - return value - } + public static func validate(_ value: To) throws -> To { + let _ = try transform(value) + return value + } }