Skip to content
On this page

@shaggytools/nhtsa-api-wrapper - v3.0.4 / Exports / utils/isValidVin

Module: utils/isValidVin ​

Table of contents ​

Functions ​

Functions ​

isValidVin ​

▸ isValidVin(vin): boolean

Provides offline validation of Vehicle Identification Numbers (VINs) using the VIN Check Algorithm.

If you need to test that the algorithm is working correctly, you can use 17 ones 1 as the VIN and it should return true as the result.

Example

Browser via html script tags

ts
const isValid = NHTSA.isValidVin('3VWD07AJ5EM388202')
console.log(isValid) // true

Example

Imported as a module

ts
import { isValidVin } from '@shaggytools/nhtsa-api-wrapper'
const isValid = isValidVin('3VWD07AJ5EM388202')
console.log(isValid) // true

Parameters ​

NameTypeDescription
vinstringVehicle Identification Number.

Returns ​

boolean

True for a valid VIN, false for an invalid VIN.

Defined in ​

utils/isValidVin.ts:66

Released under the MIT License.