Skip to content

Commit

Permalink
feat: science module (#1014)
Browse files Browse the repository at this point in the history
Co-authored-by: ST-DDT <ST-DDT@gmx.de>
Co-authored-by: Shinigami <chrissi92@hotmail.de>
Co-authored-by: pkuczynski <piotr.kuczynski@gmail.com>
  • Loading branch information
4 people committed Jun 5, 2022
1 parent c401f1f commit d75d079
Show file tree
Hide file tree
Showing 13 changed files with 942 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const apiPages = [
{ text: 'Name', link: '/api/name.html' },
{ text: 'Phone', link: '/api/phone.html' },
{ text: 'Random', link: '/api/random.html' },
{ text: 'Science', link: '/api/science.html' },
{ text: 'System', link: '/api/system.html' },
{ text: 'Unique', link: '/api/unique.html' },
{ text: 'Vehicle', link: '/api/vehicle.html' },
Expand Down
1 change: 1 addition & 0 deletions scripts/generateLocales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const definitionsTypes: DefinitionsType = {
music: 'MusicDefinitions',
name: 'NameDefinitions',
phone_number: 'PhoneNumberDefinitions',
science: 'ScienceDefinitions',
system: 'SystemDefinitions',
vehicle: 'VehicleDefinitions',
word: 'WordDefinitions',
Expand Down
2 changes: 2 additions & 0 deletions src/definitions/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { LoremDefinitions } from './lorem';
import type { MusicDefinitions } from './music';
import type { NameDefinitions } from './name';
import type { PhoneNumberDefinitions } from './phone_number';
import type { ScienceDefinitions } from './science';
import type { SystemDefinitions } from './system';
import type { VehicleDefinitions } from './vehicle';
import type { WordDefinitions } from './word';
Expand Down Expand Up @@ -39,6 +40,7 @@ export interface Definitions {
music: MusicDefinitions;
name: NameDefinitions;
phone_number: PhoneNumberDefinitions;
science: ScienceDefinitions;
system: SystemDefinitions;
vehicle: VehicleDefinitions;
word: WordDefinitions;
Expand Down
1 change: 1 addition & 0 deletions src/definitions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type { LoremDefinitions } from './lorem';
export type { MusicDefinitions } from './music';
export type { NameDefinitions, NameTitleDefinitions } from './name';
export type { PhoneNumberDefinitions } from './phone_number';
export type { ScienceDefinitions } from './science';
export type {
SystemDefinitions,
SystemMimeTypeEntryDefinitions,
Expand Down
16 changes: 16 additions & 0 deletions src/definitions/science.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { ChemicalElement, Unit } from '../modules/science';
import type { LocaleEntry } from './definitions';

/**
* The possible definitions related to science.
*/
export type ScienceDefinitions = LocaleEntry<{
/**
* Some science units.
*/
unit: readonly Unit[];
/**
* Some periodic table element informtion.
*/
chemicalElement: readonly ChemicalElement[];
}>;
2 changes: 2 additions & 0 deletions src/faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Music } from './modules/music';
import { Name } from './modules/name';
import { Phone } from './modules/phone';
import { Random } from './modules/random';
import { Science } from './modules/science';
import { System } from './modules/system';
import { Unique } from './modules/unique';
import { Vehicle } from './modules/vehicle';
Expand Down Expand Up @@ -75,6 +76,7 @@ export class Faker {
readonly music: Music = new Music(this);
readonly name: Name = new Name(this);
readonly phone: Phone = new Phone(this);
readonly science: Science = new Science(this);
readonly system: System = new System(this);
readonly vehicle: Vehicle = new Vehicle(this);
readonly word: Word = new Word(this);
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type {
NameDefinitions,
NameTitleDefinitions,
PhoneNumberDefinitions,
ScienceDefinitions,
SystemDefinitions,
SystemMimeTypeEntryDefinitions,
VehicleDefinitions,
Expand All @@ -38,6 +39,7 @@ export type {
} from './modules/color';
export { Gender } from './modules/name';
export type { GenderType } from './modules/name';
export { ChemicalElement, Unit } from './modules/science';
export { Faker };

// since we are requiring the top level of faker, load all locales by default
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import lorem from './lorem';
import music from './music';
import name_ from './name';
import phone_number from './phone_number';
import science from './science';
import system from './system';
import team from './team';
import vehicle from './vehicle';
Expand All @@ -45,6 +46,7 @@ const en: LocaleDefinition = {
music,
name: name_,
phone_number,
science,
system,
team,
vehicle,
Expand Down

0 comments on commit d75d079

Please sign in to comment.