@tclohm/iadb
v1.0.8
Published
Internet Auto Database — a utility library for car makes and models
Maintainers
Readme
iadb
Internet Auto Database — a lightweight utility library for car makes and models.
Installation
npm install @tclohm/iadbUsage
import * as iadb from '@tclohm/iadb';Or import only what you need:
import { getMakes, getModels } from '@tclohm/iadb';API
getMakes()
Returns an array of all car makes.
iadb.getMakes();
// ['Acura', 'Alfa Romeo', 'Aston Martin', 'Audi', ...]getModels(make)
Returns an array of models for a given make. Case-insensitive.
iadb.getModels('Toyota');
// ['4Runner', 'Camry', 'Corolla', 'RAV4', ...]
iadb.getModels('invalid make');
// []isValidMake(make)
Returns true if the make exists in the database. Case-insensitive.
iadb.isValidMake('Ford'); // true
iadb.isValidMake('Forddd'); // falseisValidModel(make, model)
Returns true if the model exists for the given make. Case-insensitive.
iadb.isValidModel('Honda', 'Civic'); // true
iadb.isValidModel('Honda', 'Camry'); // falsesearchMakes(query)
Search makes by partial string. Case-insensitive.
iadb.searchMakes('mer');
// ['Mercedes-Benz']searchModels(query, make?)
Search models by partial string, optionally filtered by make. Returns an array of { make, model } objects.
iadb.searchModels('sport');
// [{ make: 'Hyundai', model: 'Tucson' }, { make: 'Nissan', model: 'Rogue Sport' }, ...]
iadb.searchModels('sport', 'Nissan');
// [{ make: 'Nissan', model: 'Rogue Sport' }]getAll()
Returns the full raw dataset.
iadb.getAll();
// { makes: [ { name: 'Acura', models: [...] }, ... ] }License
MIT
