Extensibility topic

The seams where a rule this package does not ship gets plugged in.

Validator and AsyncValidator are the base of every rule; implement one and attach it with .add(...) to get a check the fluent chain treats as its own.

The pattern interfaces are the narrower seam: TaxIdPattern, PostalCodePattern, PhonePattern, LicensePlatePattern and CardBrandPattern each describe one document or format, and the corresponding validator takes a list of them. That is why documents from different countries coexist in a single validation — V.string().taxId(patterns: [UsSsnPattern(), CpfPattern()]) accepts both — and why the Brazilian rules ship as a separate package instead of living here.

The implementations included cover the formats that are unambiguous internationally; anything national belongs in an extension package.

Classes

AmexBrand Extensibility
Matches American Express cards.
AsyncValidator<T> Extensibility
Abstract base class for async validators.
CaPostalCodePattern Extensibility
Matches Canadian postal codes (A1A 1A1 — space optional).
CardBrandPattern Extensibility
A pluggable credit-card brand matching strategy.
CaSinPattern Extensibility
Matches Canadian Social Insurance Numbers — 9 digits with Luhn check.
DinersBrand Extensibility
Matches Diners Club cards.
DiscoverBrand Extensibility
Matches Discover cards.
E164PhonePattern Extensibility
Default phone pattern — validates E.164 format (+ followed by 2–15 digits).
JcbBrand Extensibility
Matches JCB cards.
LicensePlatePattern Extensibility
A pluggable license-plate validation strategy.
MastercardBrand Extensibility
Matches Mastercard cards.
PhonePattern Extensibility
A pluggable phone-number validation strategy.
PostalCodePattern Extensibility
A pluggable postal-code validation strategy.
TaxIdPattern Extensibility
A pluggable tax-identifier validation strategy.
UkNiNumberPattern Extensibility
Matches UK National Insurance numbers (AB123456C).
UkPlatePattern Extensibility
Matches UK license plates in the current format (post-2001): two letters + two digits + three letters, with an optional space between the two groups (AB12 CDE or AB12CDE).
UkPostcodePattern Extensibility
Matches UK postcodes (common format; full RFC is more permissive).
UsSsnPattern Extensibility
Matches US Social Security Numbers (123-45-6789 or 123456789).
UsZipPattern Extensibility
Matches US ZIP codes (12345 or 12345-6789).
Validator<T> Extensibility
Abstract base class for all validators.
VisaBrand Extensibility
Matches Visa cards.

Enums

CountryCodeFormat Extensibility
Controls whether a leading international dialing code (e.g. +1, +55, +44) is expected on a phone number.
UuidVersion Extensibility
Supported UUID versions for filtering validation.