# vindec-nhtsa

> A VDS Decoding Plugin for vindec VIN Decoder

Latest version **2.0.0** (published 2019-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install vindec-nhtsa
pnpm add vindec-nhtsa
yarn add vindec-nhtsa
bun add vindec-nhtsa
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-01-09 |
| First published | 2017-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Philip Smith |
| Maintainers | thephilip |
| Keywords | vin decoder, vindec, vin, vds, vehicle, model, decode, nhtsa, safercar |

## Links

- npm: https://www.npmjs.com/package/vindec-nhtsa
- Homepage: https://github.com/thephilip/vindec-nhtsa
- Issues: https://github.com/thephilip/vindec-nhtsa/issues
- npm.io page: https://npm.io/package/vindec-nhtsa

## Dependencies (1)

- [vindec](https://npm.io/package/vindec.md) ^2.1.3

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-01-09
- 1.1.0 — 2017-02-17
- 1.0.5 — 2017-02-15
- 1.0.4 — 2017-02-15
- 1.0.2 — 2017-02-15
- 1.0.1 — 2017-02-15
- 1.0.0 — 2017-02-15

## README

# DEPRECATION NOTICE
This module is no longer under active development.

# NOTE: breaking changes were introduced while refactoring vindec.
I am in the process of moving this repo's functionality to the original vindec repo and decoupling this plugin architecture.  Older versions of vindec (<=2.1.3) should still work.

# vindec-nhtsa
A Vindec plugin that returns a vin object with a property called fetch that is a pending Promise that, when settled, fetches the NHTSA data from a vehicle's manufacture year and VIN.

## Install via npm (or yarn)
[![NPM](https://nodei.co/npm/vindec-nhtsa.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vindec-nhtsa)

## Returns original, vindec object (mutated)
When the decode method is called on a VIN, it returns the standard vindec decoded object, but
it also includes the URL of the API and the response data.  I may still sanitize some of the
data returned, but I may leave it as-is.  Any suggestions are greatly appreciated.

```javascript
// create and mutate
const vindec = require('vindec');
const nhtsa = require('vindec-nhtsa')(vindec);

// decode and validate
let vin = nhtsa.decode('12345678901234567', (error, data) => {
	if (error) {
		console.log('Error: ', err.message);
	}
	return data;
});

// settle pending promise
vin.fetch().then((data) => {
	// fulfilled
	vin.nhtsa = JSON.parse(data);
    console.log('--NHTSAResults:\n', vin.nhtsa.Results);
}).catch((error) => {
	// rejected
    console.log('Danger, Will Robinson! Error:\n', error);
});
```

---
_Source: https://npm.io/package/vindec-nhtsa · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
