Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(airline): add airline module #1699

Merged
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
c11fff7
Add airline module
mpetro-aa Dec 24, 2022
48e543f
Added airline module
mpetro-aa Dec 28, 2022
0791758
Added airline definitions
mpetro-aa Dec 29, 2022
405bfc4
Correctly generated locale index file for airline module
mpetro-aa Dec 29, 2022
488f9bf
Added definition file for airport codes
mpetro-aa Dec 29, 2022
3a783ee
Code and comment cleanup
mpetro-aa Dec 29, 2022
aac2e5f
More code and comment cleanup
mpetro-aa Dec 29, 2022
882f03d
Renamed airport definition file
mpetro-aa Dec 30, 2022
8a01b08
Use faker's random number generator
mpetro-aa Dec 30, 2022
7ca3d3c
Correctly use faker's random number generator
mpetro-aa Dec 30, 2022
5f52725
Added tests for airline module
mpetro-aa Dec 30, 2022
c6983ae
Added airline test snapshot
mpetro-aa Dec 30, 2022
3d3955e
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Dec 30, 2022
353deda
Improvements based on PR comments
mpetro-aa Dec 30, 2022
de8e31d
Reduced to only 1000 entries
mpetro-aa Dec 30, 2022
f66b256
Updated airline snapshot tests
mpetro-aa Dec 31, 2022
cf75111
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Dec 31, 2022
82ed7c7
Updated documentation and added aircraftType() function
mpetro-aa Dec 31, 2022
0d833ed
Added tests for aircraftType() function
mpetro-aa Dec 31, 2022
58daf6e
Updated airline example
mpetro-aa Dec 31, 2022
9cc0a54
Cleaned up linter issues
mpetro-aa Dec 31, 2022
8efacb0
Fixed JSDoc for aircraftType
mpetro-aa Jan 1, 2023
2158ccc
Merge branch 'faker-js:next' into feat/modules/airline/add-airline-mo…
Jan 2, 2023
66c6362
Updated airports to include name and IATA code
mpetro-aa Jan 3, 2023
aa438f6
Added airline definition file and function
mpetro-aa Jan 3, 2023
0551076
Added airplane definition file and function
mpetro-aa Jan 3, 2023
6a0e0dc
Updated type definition to match new data
mpetro-aa Jan 3, 2023
376455a
Added flightNumber function
mpetro-aa Jan 3, 2023
7703cc5
Fix for airplane definition name
mpetro-aa Jan 3, 2023
2b8d613
Updated tests to include airplane and airline
mpetro-aa Jan 3, 2023
25bf9a2
Fixed JSDocs
mpetro-aa Jan 3, 2023
495ef5e
More JSDoc updates
mpetro-aa Jan 3, 2023
1c5120c
Updated airline example in the readme
mpetro-aa Jan 3, 2023
81f9d18
Order airports by name to match other definitions
mpetro-aa Jan 3, 2023
dd9d578
Correctly formatted airplane defintion file
mpetro-aa Jan 3, 2023
bf66c27
Updated airplane definition file
mpetro-aa Jan 5, 2023
72b8e2f
Updated airport definition file
mpetro-aa Jan 5, 2023
8e2d255
Added some airports in Oceania
mpetro-aa Jan 5, 2023
8633d5b
Updated airline defintion file
mpetro-aa Jan 5, 2023
a70c48c
Updated airline module test snapshot
mpetro-aa Jan 5, 2023
95c8e19
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 5, 2023
bbc14fa
Couple fixes based on PR review comments
mpetro-aa Jan 5, 2023
38d65f1
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 5, 2023
4608ea1
Made properties of interfaces readonly
mpetro-aa Jan 6, 2023
28745ed
Don't freeze the arrays
mpetro-aa Jan 6, 2023
88c6004
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 6, 2023
9400aa4
Removed readonly from locale array definitions
mpetro-aa Jan 6, 2023
e38027d
Fixed formatting and linter issues
mpetro-aa Jan 6, 2023
886fd15
Merge branch 'next' into feat/modules/airline/add-airline-module
Jan 7, 2023
69450c0
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 10, 2023
9c67763
Added example on flightNumber function
mpetro-aa Jan 10, 2023
4869642
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 10, 2023
e51384d
Fixed docs for flightNumber function
mpetro-aa Jan 11, 2023
c782db9
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 11, 2023
a8a1c12
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 13, 2023
bc7850b
Updated JSDocs for airplane() function
mpetro-aa Jan 13, 2023
4886fe4
Merge branch 'faker-js:next' into feat/modules/airline/add-airline-mo…
Jan 16, 2023
bff87f4
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 17, 2023
b58ab6b
Renamed airline locale defintion file
mpetro-aa Jan 17, 2023
0090dcc
Regenerated airline locale index file
mpetro-aa Jan 17, 2023
032dbb1
Updated to new name for airline definition
mpetro-aa Jan 17, 2023
023cd51
Updated field name in LocaleEntry type
mpetro-aa Jan 18, 2023
8d5a2f9
Fixed flight number test
mpetro-aa Jan 18, 2023
72ca8bd
Merge branch 'faker-js:next' into feat/modules/airline/add-airline-mo…
Jan 18, 2023
b81ea07
Merge branch 'faker-js:next' into feat/modules/airline/add-airline-mo…
Jan 21, 2023
fad2a24
Updated JSDocs for option params
mpetro-aa Jan 21, 2023
af1aa91
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 22, 2023
0e20de6
Added param doc for flightNumber length
mpetro-aa Jan 22, 2023
6d5089f
Specify types for lookup objects
mpetro-aa Jan 28, 2023
4d9a180
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 29, 2023
e31f582
Merge branch 'next' into feat/modules/airline/add-airline-module
mpetro-aa Jan 29, 2023
b9bb89b
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 29, 2023
6e50b54
Fixed en locale index file
mpetro-aa Jan 30, 2023
ea7d931
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 30, 2023
b2ebec8
Merge branch 'next' into feat/modules/airline/add-airline-module
ST-DDT Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The API covers the following modules:

| Module | Example | Output |
| -------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| Airline | `faker.airline.recordLocator()` | KIFRWE
matthewpetro marked this conversation as resolved.
Show resolved Hide resolved
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
| Animal | `faker.animal.cat()` | Norwegian Forest Cat |
| Color | `faker.color.rgb()` | #cdfcdc |
| Commerce | `faker.commerce.product()` | Polo t-shirt |
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Run 'pnpm run generate:api-docs' to update
export const apiPages = [
{ text: 'Overview', link: '/api/' },
{ text: 'Airline', link: '/api/airline.html' },
{ text: 'Animal', link: '/api/animal.html' },
{ text: 'Color', link: '/api/color.html' },
{ text: 'Commerce', link: '/api/commerce.html' },
Expand Down
1 change: 1 addition & 0 deletions scripts/generateLocales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type DefinitionsType = {
* The types of the definitions.
*/
const definitionsTypes: DefinitionsType = {
airline: 'AirlineDefinitions',
animal: 'AnimalDefinitions',
color: 'ColorDefinitions',
commerce: 'CommerceDefinitions',
Expand Down
8 changes: 8 additions & 0 deletions src/definitions/airline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { LocaleEntry } from './definitions';

export type AirlineDefinitions = LocaleEntry<{
/**
* IATA three-letter airport codes.
*/
airport: string[];
}>;
2 changes: 2 additions & 0 deletions src/definitions/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AirlineDefinitions } from './airline';
import type { AnimalDefinitions } from './animal';
import type { ColorDefinitions } from './color';
import type { CommerceDefinitions } from './commerce';
Expand Down Expand Up @@ -26,6 +27,7 @@ export type LocaleEntry<T> = Partial<T> &
* The definitions as used by the Faker modules.
*/
export interface Definitions {
airline: AirlineDefinitions;
animal: AnimalDefinitions;
color: ColorDefinitions;
commerce: CommerceDefinitions;
Expand Down
1 change: 1 addition & 0 deletions src/definitions/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export type { AirlineDefinitions } from './airline';
export type { AnimalDefinitions } from './animal';
export type { ColorDefinitions } from './color';
export type {
Expand Down
2 changes: 2 additions & 0 deletions src/faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { deprecated } from './internal/deprecated';
import type { Mersenne } from './internal/mersenne/mersenne';
import mersenne from './internal/mersenne/mersenne';
import type { KnownLocale } from './locales';
import { AirlineModule } from './modules/airline';
import { AnimalModule } from './modules/animal';
import { ColorModule } from './modules/color';
import { CommerceModule } from './modules/commerce';
Expand Down Expand Up @@ -89,6 +90,7 @@ export class Faker {

readonly datatype: DatatypeModule = new DatatypeModule(this);

readonly airline: AirlineModule = new AirlineModule(this);
readonly animal: AnimalModule = new AnimalModule(this);
readonly color: ColorModule = new ColorModule(this);
readonly commerce: CommerceModule = new CommerceModule(this);
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Faker } from './faker';
import allLocales from './locales';

export type {
AirlineDefinitions,
AnimalDefinitions,
ColorDefinitions,
CommerceDefinitions,
Expand Down Expand Up @@ -35,6 +36,8 @@ export type {
} from './definitions';
export { FakerError } from './errors/faker-error';
export type { FakerOptions, UsableLocale, UsedLocales } from './faker';
export { Aircraft, AircraftType } from './modules/airline';
export type { AirlineModule } from './modules/airline';
export type { AnimalModule } from './modules/animal';
export type {
Casing,
Expand Down
Loading