1.0.4 • Published 2 years ago
@joshmakar/nhtsa v1.0.4
A NPM package for fetching and parsing vehicle data from the NHTSA Vehicle API
Originally forked from iMears/nhtsa
Installation
npm install @joshmakar/nhtsaUsage
import nhtsa from '@joshmakar/nhtsa';
// Example using async/await
(async () => {
  const { data } = await nhtsa.decodeVin('WUAAU34248N006164');
  console.log(data);
})();
// Example using a promise
nhtsa.decodeVin('WUAAU34248N006164').then(
  ({ data }) => console.log(data),
  error => console.log(error)
);API Actions
Decode Vin
const { data } = await nhtsa.decodeVin('WUAAU34248N006164');Decode VIN (flat format)
const { data } = await nhtsa.decodeVinFlatFormat('WUAAU34248N006164');Decode VIN Extended
const { data } = await nhtsa.decodeVinExtended('WUAAU34248N006164');Decode VIN Extended (flat format)
const { data } = await nhtsa.decodeVinExtendedFlatFormat('WUAAU34248N006164');Decode WMI
const { data } = await nhtsa.decodeWmi('1FD');Decode SAE WMI
const { data } = await nhtsa.decodeSaeWmi('1FD');Get WMIs for Manufacturer
const { data } = await nhtsa.getWmisForManufacturer('hon');Get SAE WMIs for Manufacturer
const { data } = await nhtsa.getSaeWmisForManufacturer('hon');Get All Makes
const { data } = await nhtsa.getAllMakes();Get Parts
const type = 565;
const fromDate = '3/2/2018';
const toDate = '3/10/2018';
const page = 2;
const { data } = await nhtsa.getParts(type, fromDate, toDate, page);Get All Manufacturers
const { data } = await nhtsa.getAllManufacturers();Get Manufacturer Details
const { data } = await nhtsa.getManufacturerDetails('volkswagen');Get Makes for Manufacturer by Manufacturer Name
const { data } = await nhtsa.getMakesForManufacturer('volkswagen');