fix: Short VIN Storage - Issue #1
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m31s
Deploy to Staging / Deploy to Staging (push) Successful in 36s
Deploy to Staging / Verify Staging (push) Successful in 5s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m31s
Deploy to Staging / Deploy to Staging (push) Successful in 36s
Deploy to Staging / Verify Staging (push) Successful in 5s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
This commit is contained in:
@@ -19,12 +19,20 @@ export function isValidUUID(uuid: string): boolean {
|
||||
}
|
||||
|
||||
export function isValidVIN(vin: string): boolean {
|
||||
// VIN must be exactly 17 characters
|
||||
// VIN must be exactly 17 characters (modern VIN standard since 1981)
|
||||
if (vin.length !== 17) return false;
|
||||
|
||||
|
||||
// VIN cannot contain I, O, or Q
|
||||
if (/[IOQ]/i.test(vin)) return false;
|
||||
|
||||
|
||||
// Must be alphanumeric
|
||||
return /^[A-HJ-NPR-Z0-9]{17}$/i.test(vin);
|
||||
}
|
||||
|
||||
export function isValidPreModernVIN(vin: string): boolean {
|
||||
// Pre-1981 vehicles had non-standardized VINs of varying lengths (1-17 characters)
|
||||
if (vin.length < 1 || vin.length > 17) return false;
|
||||
|
||||
// Must be alphanumeric (allow I, O, Q for pre-1981 as they weren't banned yet)
|
||||
return /^[A-Z0-9]+$/i.test(vin);
|
||||
}
|
||||
Reference in New Issue
Block a user