Skip to content

Commit fd652d9

Browse files
authored
Merge branch 'next' into docs/next-version-number
2 parents 98ebed3 + b983ca1 commit fd652d9

File tree

871 files changed

+2525
-1441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

871 files changed

+2525
-1441
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ feat: add casing option
437437
feat(locale): extend Hebrew (he)
438438
fix: lower target to support Webpack 4
439439
chore: add naming convention rule
440-
refactor(address): deprecate streetPrefix and streetSuffix
440+
refactor(location): deprecate streetPrefix and streetSuffix
441441
docs: remove unused playground
442442
test: validate @see contents
443443
ci: allow breaking change commits

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
## 🚀 Features
2323

24-
- 💌 Addresses - Generate valid looking Addresses, Zip Codes, Street Names, States, and Countries!
24+
- 💌 Locations - Generate valid looking Addresses, Zip Codes, Street Names, States, and Countries!
2525
- ⏰ Time-based Data - Past, present, future, recent, soon... whenever!
2626
- 🌏 Localization - Set a locale to generate realistic looking Names, Addresses, and Phone Numbers.
2727
- 💸 Finance - Create stubbed out Account Details, Transactions, and Crypto Addresses.
@@ -72,7 +72,6 @@ The API covers the following modules:
7272

7373
| Module | Example | Output |
7474
| -------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------- |
75-
| Address | `faker.address.city()` | Lake Raoulfort |
7675
| Animal | `faker.animal.cat()` | Norwegian Forest Cat |
7776
| Color | `faker.color.rgb()` | #cdfcdc |
7877
| Commerce | `faker.commerce.product()` | Polo t-shirt |
@@ -86,6 +85,7 @@ The API covers the following modules:
8685
| Helpers | `faker.helpers.arrayElement(['a', 'b', 'c'])` | b |
8786
| Image | `faker.image.cats()` | https://loremflickr.com/640/480/cats <img src="https://loremflickr.com/640/480/cats" height="100"> |
8887
| Internet | `faker.internet.domainName()` | muddy-neuropathologist.net |
88+
| Location | `faker.location.city()` | Lake Raoulfort |
8989
| Lorem | `faker.lorem.paragraph()` | Porro nulla id vero perspiciatis nulla nihil. ... |
9090
| Music | `faker.music.genre()` | R&B |
9191
| Person | `faker.person.firstName()` | Cameron |

docs/.vitepress/api-pages.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Run 'pnpm run generate:api-docs' to update
33
export const apiPages = [
44
{ text: 'Overview', link: '/api/' },
5-
{ text: 'Address', link: '/api/address.html' },
65
{ text: 'Animal', link: '/api/animal.html' },
76
{ text: 'Color', link: '/api/color.html' },
87
{ text: 'Commerce', link: '/api/commerce.html' },
@@ -16,12 +15,14 @@ export const apiPages = [
1615
{ text: 'Helpers', link: '/api/helpers.html' },
1716
{ text: 'Image', link: '/api/image.html' },
1817
{ text: 'Internet', link: '/api/internet.html' },
18+
{ text: 'Location', link: '/api/location.html' },
1919
{ text: 'Lorem', link: '/api/lorem.html' },
2020
{ text: 'Music', link: '/api/music.html' },
2121
{ text: 'Person', link: '/api/person.html' },
2222
{ text: 'Phone', link: '/api/phone.html' },
2323
{ text: 'Random', link: '/api/random.html' },
2424
{ text: 'Science', link: '/api/science.html' },
25+
{ text: 'String', link: '/api/string.html' },
2526
{ text: 'System', link: '/api/system.html' },
2627
{ text: 'Vehicle', link: '/api/vehicle.html' },
2728
{ text: 'Word', link: '/api/word.html' },

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ features:
2424
title: Finance
2525
details: Create stubbed out Account Details, Transactions, and Crypto Addresses.
2626
- icon: 💌
27-
title: Addresses
27+
title: Locations
2828
details: Generate valid Addresses, Zip Codes, Street Names, States, and Countries!
2929
- icon: 👾
3030
title: Hacker Jargon

scripts/apidoc/moduleMethods.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export function extractModuleName(module: DeclarationReflection): string {
4141
const { name } = module;
4242
// TODO @ST-DDT 2022-10-16: Remove in v10.
4343
// Typedoc prefers the name of the module that is exported first.
44-
if (name === 'NameModule') {
44+
if (name === 'AddressModule') {
45+
return 'Location';
46+
} else if (name === 'NameModule') {
4547
return 'Person';
4648
}
4749
return name.replace(/Module$/, '');

scripts/generateLocales.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ type DefinitionsType = {
4545
* The types of the definitions.
4646
*/
4747
const definitionsTypes: DefinitionsType = {
48-
address: 'AddressDefinitions',
4948
animal: 'AnimalDefinitions',
5049
color: 'ColorDefinitions',
5150
commerce: 'CommerceDefinitions',
@@ -55,6 +54,7 @@ const definitionsTypes: DefinitionsType = {
5554
finance: 'FinanceDefinitions',
5655
hacker: 'HackerDefinitions',
5756
internet: 'InternetDefinitions',
57+
location: 'LocationDefinitions',
5858
lorem: 'LoremDefinitions',
5959
music: 'MusicDefinitions',
6060
person: 'PersonDefinitions',

src/definitions/definitions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { AddressDefinitions } from './address';
21
import type { AnimalDefinitions } from './animal';
32
import type { ColorDefinitions } from './color';
43
import type { CommerceDefinitions } from './commerce';
@@ -8,6 +7,7 @@ import type { DateDefinitions } from './date';
87
import type { FinanceDefinitions } from './finance';
98
import type { HackerDefinitions } from './hacker';
109
import type { InternetDefinitions } from './internet';
10+
import type { LocationDefinitions } from './location';
1111
import type { LoremDefinitions } from './lorem';
1212
import type { MusicDefinitions } from './music';
1313
import type { PersonDefinitions } from './person';
@@ -26,7 +26,6 @@ export type LocaleEntry<T> = Partial<T> &
2626
* The definitions as used by the Faker modules.
2727
*/
2828
export interface Definitions {
29-
address: AddressDefinitions;
3029
animal: AnimalDefinitions;
3130
color: ColorDefinitions;
3231
commerce: CommerceDefinitions;
@@ -36,6 +35,7 @@ export interface Definitions {
3635
finance: FinanceDefinitions;
3736
hacker: HackerDefinitions;
3837
internet: InternetDefinitions;
38+
location: LocationDefinitions;
3939
lorem: LoremDefinitions;
4040
music: MusicDefinitions;
4141
person: PersonDefinitions;

src/definitions/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export type { AddressDefinitions } from './address';
21
export type { AnimalDefinitions } from './animal';
32
export type { ColorDefinitions } from './color';
43
export type {
@@ -15,6 +14,7 @@ export type {
1514
} from './finance';
1615
export type { HackerDefinitions } from './hacker';
1716
export type { InternetDefinitions } from './internet';
17+
export type { LocationDefinitions } from './location';
1818
export type { LoremDefinitions } from './lorem';
1919
export type { MusicDefinitions } from './music';
2020
export type { PersonDefinitions, PersonTitleDefinitions } from './person';

src/definitions/address.ts src/definitions/location.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { LocaleEntry } from './definitions';
22

33
/**
4-
* The possible definitions related to addresses.
4+
* The possible definitions related to addresses and locations.
55
*/
6-
export type AddressDefinitions = LocaleEntry<{
6+
export type LocationDefinitions = LocaleEntry<{
77
/**
88
* Postcodes patterns by state
99
*/

src/faker.ts

+29-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { FakerError } from './errors/faker-error';
33
import { deprecated } from './internal/deprecated';
44
import { MersenneModule } from './internal/mersenne/mersenne';
55
import type { KnownLocale } from './locales';
6-
import { AddressModule } from './modules/address';
76
import { AnimalModule } from './modules/animal';
87
import { ColorModule } from './modules/color';
98
import { CommerceModule } from './modules/commerce';
@@ -17,13 +16,16 @@ import { HackerModule } from './modules/hacker';
1716
import { HelpersModule } from './modules/helpers';
1817
import { ImageModule } from './modules/image';
1918
import { InternetModule } from './modules/internet';
19+
import type { LocationModule as AddressModule } from './modules/location';
20+
import { LocationModule } from './modules/location';
2021
import { LoremModule } from './modules/lorem';
2122
import { MusicModule } from './modules/music';
2223
import type { PersonModule as NameModule } from './modules/person';
2324
import { PersonModule } from './modules/person';
2425
import { PhoneModule } from './modules/phone';
2526
import { RandomModule } from './modules/random';
2627
import { ScienceModule } from './modules/science';
28+
import { StringModule } from './modules/string';
2729
import { SystemModule } from './modules/system';
2830
import { VehicleModule } from './modules/vehicle';
2931
import { WordModule } from './modules/word';
@@ -85,7 +87,6 @@ export class Faker {
8587

8688
readonly datatype: DatatypeModule = new DatatypeModule(this);
8789

88-
readonly address: AddressModule = new AddressModule(this);
8990
readonly animal: AnimalModule = new AnimalModule(this);
9091
readonly color: ColorModule = new ColorModule(this);
9192
readonly commerce: CommerceModule = new CommerceModule(this);
@@ -97,23 +98,36 @@ export class Faker {
9798
readonly hacker: HackerModule = new HackerModule(this);
9899
readonly image: ImageModule = new ImageModule(this);
99100
readonly internet: InternetModule = new InternetModule(this);
101+
readonly location: LocationModule = new LocationModule(this);
100102
readonly lorem: LoremModule = new LoremModule(this);
101103
readonly music: MusicModule = new MusicModule(this);
102104
readonly person: PersonModule = new PersonModule(this);
103105
readonly phone: PhoneModule = new PhoneModule(this);
104106
readonly science: ScienceModule = new ScienceModule(this);
107+
readonly string: StringModule = new StringModule(this);
105108
readonly system: SystemModule = new SystemModule(this);
106109
readonly vehicle: VehicleModule = new VehicleModule(this);
107110
readonly word: WordModule = new WordModule(this);
108111

109112
// Aliases
113+
/** @deprecated Use {@link location} instead */
114+
get address(): AddressModule {
115+
deprecated({
116+
deprecated: 'faker.address',
117+
proposed: 'faker.location',
118+
since: '8.0',
119+
until: '10.0',
120+
});
121+
return this.location;
122+
}
123+
110124
/** @deprecated Use {@link person} instead */
111125
get name(): NameModule {
112126
deprecated({
113127
deprecated: 'faker.name',
114128
proposed: 'faker.person',
115-
since: '8.0.0',
116-
until: '10.0.0',
129+
since: '8.0',
130+
until: '10.0',
117131
});
118132
return this.person;
119133
}
@@ -173,13 +187,21 @@ export class Faker {
173187
return new Proxy({} as LocaleDefinition, {
174188
get(target: LocaleDefinition, module: string): unknown {
175189
// Support aliases
176-
if (module === 'name') {
190+
if (module === 'address') {
191+
module = 'location';
192+
deprecated({
193+
deprecated: `faker.helpers.fake('{{address.*}}') or faker.definitions.address`,
194+
proposed: `faker.helpers.fake('{{location.*}}') or faker.definitions.location`,
195+
since: '8.0',
196+
until: '10.0',
197+
});
198+
} else if (module === 'name') {
177199
module = 'person';
178200
deprecated({
179201
deprecated: `faker.helpers.fake('{{name.*}}') or faker.definitions.name`,
180202
proposed: `faker.helpers.fake('{{person.*}}') or faker.definitions.person`,
181-
since: '8.0.0',
182-
until: '10.0.0',
203+
since: '8.0',
204+
until: '10.0',
183205
});
184206
}
185207

src/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Faker } from './faker';
22
import allLocales from './locales';
33

44
export type {
5-
AddressDefinitions,
65
AnimalDefinitions,
76
ColorDefinitions,
87
CommerceDefinitions,
@@ -16,6 +15,9 @@ export type {
1615
HackerDefinitions,
1716
InternetDefinitions,
1817
LocaleDefinition,
18+
/** @deprecated Use LocationDefinitions instead */
19+
LocationDefinitions as AddressDefinitions,
20+
LocationDefinitions,
1921
LoremDefinitions,
2022
MusicDefinitions,
2123
/** @deprecated Use PersonDefinitions instead */
@@ -33,7 +35,6 @@ export type {
3335
} from './definitions';
3436
export { FakerError } from './errors/faker-error';
3537
export type { FakerOptions, UsableLocale, UsedLocales } from './faker';
36-
export type { AddressModule } from './modules/address';
3738
export type { AnimalModule } from './modules/animal';
3839
export type {
3940
Casing,
@@ -55,6 +56,11 @@ export type { HackerModule } from './modules/hacker';
5556
export type { HelpersModule } from './modules/helpers';
5657
export type { ImageModule } from './modules/image';
5758
export type { InternetModule } from './modules/internet';
59+
export type {
60+
/** @deprecated Use LocationModule instead */
61+
LocationModule as AddressModule,
62+
LocationModule,
63+
} from './modules/location';
5864
export type { LoremModule } from './modules/lorem';
5965
export type { MusicModule } from './modules/music';
6066
export { Sex } from './modules/person';
@@ -67,6 +73,7 @@ export type {
6773
export type { PhoneModule } from './modules/phone';
6874
export type { RandomModule } from './modules/random';
6975
export type { ChemicalElement, ScienceModule, Unit } from './modules/science';
76+
export type { StringModule } from './modules/string';
7077
export type { SystemModule } from './modules/system';
7178
export type { VehicleModule } from './modules/vehicle';
7279
export type { WordModule } from './modules/word';

src/locales/af_ZA/address/city.ts

-6
This file was deleted.

src/locales/af_ZA/address/street.ts

-4
This file was deleted.

src/locales/af_ZA/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
* Run 'pnpm run generate:locales' to update.
44
*/
55
import type { LocaleDefinition } from '../..';
6-
import address from './address';
76
import cell_phone from './cell_phone';
87
import company from './company';
98
import internet from './internet';
9+
import location from './location';
1010
import person from './person';
1111
import phone_number from './phone_number';
1212

1313
const af_ZA: LocaleDefinition = {
1414
title: 'Afrikaans',
15-
address,
1615
cell_phone,
1716
company,
1817
internet,
18+
location,
1919
person,
2020
phone_number,
2121
};

src/locales/af_ZA/location/city.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default [
2+
'{{location.city_prefix}} {{person.firstName}}{{location.city_suffix}}',
3+
'{{location.city_prefix}} {{person.firstName}}',
4+
'{{person.firstName}}{{location.city_suffix}}',
5+
'{{person.lastName}}{{location.city_suffix}}',
6+
];

src/locales/zu_ZA/address/index.ts src/locales/af_ZA/location/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
* This file is automatically generated.
33
* Run 'pnpm run generate:locales' to update.
44
*/
5-
import type { AddressDefinitions } from '../../..';
5+
import type { LocationDefinitions } from '../../..';
66
import city from './city';
77
import default_country from './default_country';
88
import postcode from './postcode';
99
import street from './street';
1010

11-
const address: AddressDefinitions = {
11+
const location: LocationDefinitions = {
1212
city,
1313
default_country,
1414
postcode,
1515
street,
1616
};
1717

18-
export default address;
18+
export default location;
File renamed without changes.

src/locales/af_ZA/location/street.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default [
2+
'{{person.firstName}} {{location.street_suffix}}',
3+
'{{person.lastName}} {{location.street_suffix}}',
4+
];

src/locales/ar/address/city.ts

-1
This file was deleted.

src/locales/ar/address/street.ts

-4
This file was deleted.

src/locales/ar/address/street_address.ts

-4
This file was deleted.

src/locales/ar/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Run 'pnpm run generate:locales' to update.
44
*/
55
import type { LocaleDefinition } from '../..';
6-
import address from './address';
76
import cell_phone from './cell_phone';
87
import color from './color';
98
import commerce from './commerce';
109
import date from './date';
10+
import location from './location';
1111
import person from './person';
1212
import phone_number from './phone_number';
1313
import team from './team';
@@ -16,11 +16,11 @@ import vehicle from './vehicle';
1616
const ar: LocaleDefinition = {
1717
title: 'Arabic',
1818
separator: ' & ',
19-
address,
2019
cell_phone,
2120
color,
2221
commerce,
2322
date,
23+
location,
2424
person,
2525
phone_number,
2626
team,

src/locales/ar/location/city.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default ['{{location.city_name}}'];
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)