Install via npm
$ npm install --save vehicle-identification-number
var VIN = require( 'vehicle-identification-number' )
// German Porsche 993 GT2
var vin = VIN.parse( 'WP0ZZZ99ZTS392124' ) // OR
var vin = new VIN( 'WP0ZZZ99ZTS392124' )
> VIN {
region: 'EU',
country: 'DE',
assemblyPlant: 'S',
checksum: null,
modelYear: 'T',
serialNumber: '92124',
wmi: 'WP0',
vds: 'ZZZ99Z',
vis: 'TS392124'
}
// You can also only get parts relevant to you
VIN.getCountry( 'WP0ZZZ99ZTS392124' ) // -> 'DE'
VIN.getRegion( 'WP0ZZZ99ZTS392124' ) // -> 'EU'
VIN.getChecksum( 'WP0ZZZ99ZTS392124' ) // -> null (Europe does not use checksums)
VIN.hasValidChecksum( 'WP0ZZZ99ZTS392124' ) // -> true
VIN.getCountry( '1GNSCJKC9FR264648' ) // -> 'US'
VIN.getChecksum( '1GNSCJKC9FR264648' ) // -> '9'
VIN.hasValidChecksum( '1GNSCJKC9FR264648' ) // -> true
VIN.calculateChecksum( '1GNSCJKC9FR264648' ) // '9'
VIN.normalize( '1GN-SCJKC9-FR264648' ) // -> '1GNSCJKC9FR264648'
vin.toString() // -> 'WP0ZZZ99ZTS392124'