-
Declaration
Swift
typealias ValidationScheme = (isComplete: Bool, scheme: Card.Scheme) -
Run a validation on an input that is known to be incomplete
Declaration
Swift
func eagerValidate(cardNumber: String) -> Result<Card.Scheme, ValidationError.EagerCardNumber>Parameters
cardNumberincomplete card number to be verified if matching a Card Scheme
Return Value
Result with a card scheme if matched or a matching error otherwise
-
Run a validation on an input that is expected to be a card number
Declaration
Swift
func validate(cardNumber: String) -> Result<Card.Scheme, ValidationError.CardNumber>Parameters
cardNumbercomplete card number to be verified if matching a Card Scheme
Return Value
Result with a card scheme if matched or a matching error otherwise
-
Run a validation on an input that is expected to match a card number but unknown whether complete or not
Declaration
Swift
func validateCompleteness(cardNumber: String) -> Result<ValidationScheme, ValidationError.CardNumber>Parameters
cardNumberincomplete card number to be verified if matching a Card Scheme
Return Value
ValidationScheme if successful. This will contain the scheme matched and a boolean to describe if input is complete card number or partial. ValidationError if a scheme could not be matched
View on GitHub
CardNumberValidating