valtype::c...d::discover(3tcl)
π³ valtype::c...d::discover β aka valtype::creditcard::discover (3tcl)
okay bestie, welcome to the manual page for valtype::creditcard::discover, part of tcllib β no cap, we're about to validate some Discover creditcard numbers and it's giving very much "trust but verify" π
β¨ NAME β¨
valtype::creditcard::discover β validation for Discover creditcard number π
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require snit 2
package require valtype::common
package require valtype::luhn
package require valtype::creditcard::discover ?1.1?
valtype::creditcard::discover validate value
valtype::creditcard::discover checkdigit value
β¨ DESCRIPTION β¨
So this package implements a snit validation type for a Discover creditcard number. fr fr.
A validation type is basically an object you can use to validate Tcl values of a particular kind. Like, for example, snit::integer β a validation type defined by the snit package β is used to validate that a Tcl value is an integer. Same energy, different card. π¦
Every validation type has a validate method, and that's the one doing the actual validating. It must take a single argument β the value to be validated β and further, it must do nothing if the value is valid, but throw an error if the value is invalid:
valtype::creditcard::discover validate .... ;# Does nothing
valtype::creditcard::discover validate .... ;# Throws an error (bad Discover creditcard number).
The validate method will always return the validated value on success, and throw the -errorcode INVALID on error, possibly with additional elements that provide more details about the problem. extra receipts, iykyk π§Ύβ¨
β¨ API β¨
The API provided by this package satisfies the specification of snit validation types found in the documentation of Snit's Not Incr Tcl. iconic behaviour, honestly π
valtype::creditcard::discover validate valueβ This method validates the value and returns it, possibly in a canonical form, if it passes. If the value does not pass the validation, an error is thrown. it either slays or it gets yeeted πvaltype::creditcard::discover checkdigit valueβ This method computes a check digit for the value. Before doing so it is validated, except for a checkdigit. If the value does not pass the validation, no check digit is calculated and an error is thrown instead. like, no digit for you bestie π
β¨ ERROR CODES β¨
As said in the package description, the errors thrown by the commands of this package in response to input validation failures use the -errorcode INVALID to distinguish themselves from package internal errors. periodt.
To provide more detailed information about why the validation failed, the -errorCode goes actually beyond that. First, it will contain a code detailing the type itself. Here this is CREDITCARD DISCOVER. This is then followed by values detailing the reason for the failure. The full set of -errorCodes which can be thrown by this package are:
INVALID CREDITCARD DISCOVER CHARACTERβ The input value contained one or more bad characters, i.e. characters which must not occur in the input for it to be a Discover creditcard number. π«INVALID CREDITCARD DISCOVER CHECK-DIGITβ The check digit of the input value is wrong. This usually signals a data-entry error, with digits transposed, forgotten, etc. Of course, th input may be an outright fake too. πINVALID CREDITCARD DISCOVER LENGTHβ The input value is of the wrong length to be a Discover creditcard number. too short? too long? vibe check failed. πINVALID CREDITCARD DISCOVER PREFIXβ The input value does not start with the magic value(s) required for it to be a Discover creditcard number. β¨ no magic prefix, no entry.
β¨ BUGS, IDEAS, FEEDBACK β¨
This document, and the package it describes, will undoubtedly contain bugs and other problems. π Please report such in the category valtype of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist](http://core.tcl.tk/tcllib/reportlist). Please also report any ideas for enhancements you may have for either package and/or documentation. we love feedback bestie π«Ά
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. π
β¨ KEYWORDS β¨
Checking, Discover, Testing, Type checking, Validation, Value checking, bank, card for credit, credit card, finance, isA π
β¨ CATEGORY β¨
Validation, Type checking π
β¨ COPYRIGHT β¨
Copyright (c) 2011 Andreas Kupries <andreas_kupries@users.sourceforge.net>
okay that's the whole page, bestie β sending you off with the source and version deets: this is from tcllib, version 1.1, manual page valtype::c...d::discover(3tcl). go forth and validate responsibly πβ¨π¦
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2011 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms