Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.8 KB

File metadata and controls

44 lines (35 loc) · 1.8 KB

node-vehicle-logos

A collection of vehicle manufacturer logos. All logos are registered trademarks of their respective owners.

Installation

npm i node-vehicle-logos

Logo Assets

The assets directory contains SVGs of all the available logos. There is also makes.json file which contains the definition for each make, including possible alternative names. In some cases where a logo may contain text, there may also be "short" version. For example

Standard vs Short

rolls-royce rolls-royce-short
rolls-royce rolls-royce-short

Additional assets

In addition, there are some SVG assets for generic vehicle types:

Typescript library

The package also includes some typescript helpers and constants:

VehicleMakes

This is an the list of definitions from makes.json exported as a ReadonlyArray<Readonly<VehicleMake>>.

Functions

findMake

findMake is a function that can take a string and find the best matching make using the VehicleMake.name and VehicleMake.altNames. It can also take:

  • an optional MatchType property to specify what kind of match to use. Defaults to full if not specified
Usage
import { findMake, MatchType, VehicleMake, VehicleMakes } from "node-vehicle-logos";

const bmw1 = findMake("BMW", VehicleMakes);
const bmw2 = findMake("2020 BMW i8", VehicleMakes, "contains");
const bmw3 = findMake("BMW i8", VehicleMakes, "start");
const bmw4 = findMake("2020 BMW", VehicleMakes, "end");

const notFound = findMake("BMW i8", VehicleMakes); // Returns undefined as 'BMW i8' is not a full match