Skip to content

refactor(random)!: remove v8 deprecated random module #2678

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

Merged
merged 6 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 1 deletion docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const apiPages = [
{ text: 'Number', link: '/api/number.html' },
{ text: 'Person', link: '/api/person.html' },
{ text: 'Phone', link: '/api/phone.html' },
{ text: 'Random', link: '/api/random.html' },
{ text: 'Science', link: '/api/science.html' },
{ text: 'String', link: '/api/string.html' },
{ text: 'System', link: '/api/system.html' },
Expand Down
12 changes: 12 additions & 0 deletions docs/guide/upgrading_v9/2678.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Remove deprecated random module

Removed deprecated random module

| old | replacement |
| ----------------------------- | ----------------------------------------------- |
| `faker.random.alpha()` | `faker.string.alpha()` |
| `faker.random.alphaNumeric()` | `faker.string.alphanumeric()` |
| `faker.random.locale()` | `faker.helpers.objectKey(allLocales/allFakers)` |
| `faker.random.numeric()` | `faker.string.numeric()` |
| `faker.random.word()` | `faker.lorem.word()` or `faker.word.sample()` |
| `faker.random.words()` | `faker.lorem.words()` or `faker.word.words()` |
7 changes: 0 additions & 7 deletions src/faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { MusicModule } from './modules/music';
import type { PersonModule as NameModule } from './modules/person';
import { PersonModule } from './modules/person';
import { PhoneModule } from './modules/phone';
import { RandomModule } from './modules/random';
import { ScienceModule } from './modules/science';
import { SystemModule } from './modules/system';
import { VehicleModule } from './modules/vehicle';
Expand Down Expand Up @@ -62,12 +61,6 @@ export class Faker extends SimpleFaker {
readonly rawDefinitions: LocaleDefinition;
readonly definitions: LocaleProxy;

/**
* @deprecated Use the modules specific to the type of data you want to generate instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly random: RandomModule = new RandomModule(this);

readonly airline: AirlineModule = new AirlineModule(this);
readonly animal: AnimalModule = new AnimalModule(this);
readonly color: ColorModule = new ColorModule(this);
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ export type {
SexType,
} from './modules/person';
export type { PhoneModule } from './modules/phone';
// eslint-disable-next-line deprecation/deprecation
export type { RandomModule } from './modules/random';
export type { ChemicalElement, ScienceModule, Unit } from './modules/science';
export type { StringModule } from './modules/string';
export type { SystemModule } from './modules/system';
Expand Down
Loading