Skip to content

jhermsmeier/node-vehicle-identification-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vehicle Identification Number (VIN)

npm npm license npm downloads build status

Install via npm

$ npm install --save vehicle-identification-number

Usage

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'