Generates a random airline.
Generates a random airplane.
Generates a random airport.
Returns a random flight number. Flight numbers are always 1 to 4 digits long. Sometimes they are
used without leading zeros (e.g.: American Airlines flight 425
) and sometimes with leading
zeros, often with the airline code prepended (e.g.: AA0425
).
To generate a flight number prepended with an airline code, combine this function with the
airline()
function and use template literals:
`${faker.airline.airline().iataCode}${faker.airline.flightNumber({ addLeadingZeros: true })}` // 'AA0798'
Optional
options: { addLeadingZeros?: boolean; length?: number | { max: number; min: number } }The options to use.
Optional
addLeadingZeros?: booleanWhether to pad the flight number up to 4 digits with leading zeros.
Optional
length?: number | { max: number; min: number }The number or range of digits to generate.
faker.airline.flightNumber() // '2405'
faker.airline.flightNumber({ addLeadingZeros: true }) // '0249'
faker.airline.flightNumber({ addLeadingZeros: true, length: 2 }) // '0042'
faker.airline.flightNumber({ addLeadingZeros: true, length: { min: 2, max: 3 } }) // '0624'
faker.airline.flightNumber({ length: 3 }) // '425'
faker.airline.flightNumber({ length: { min: 2, max: 3 } }) // '84'
Generates a random record locator. Record locators are used by airlines to identify reservations. They're also known as booking reference numbers, locator codes, confirmation codes, or reservation codes.
Optional
options: { allowNumerics?: boolean; allowVisuallySimilarCharacters?: boolean }The options to use.
Optional
allowNumerics?: booleanWhether to allow numeric characters.
Optional
allowVisuallySimilarCharacters?: booleanWhether to allow visually similar characters such as '1' and 'I'.
Generates a random seat.
Optional
options: { aircraftType?: "narrowbody" | "regional" | "widebody" }The options to use.
Optional
aircraftType?: "narrowbody" | "regional" | "widebody"The aircraft type. Can be one of narrowbody
, regional
, widebody
.
Module to generate airline and airport related data.
Overview
Several methods in this module return objects rather than strings. For example, you can use
faker.airline.airport().iataCode
to pick out the specific property you need.For a random airport, use
airport()
.For a random airline, use
airline()
.For a dummy booking, a passenger will generally book a flight on a specific
flightNumber()
,airplane()
, be allocated aseat()
, andrecordLocator()
.Related Modules
faker.person
module.