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

refactor!: remove deprecations #916

Merged
merged 4 commits into from
May 4, 2022
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 @@ -23,7 +23,6 @@ export const apiPages = [
{ text: 'Phone', link: '/api/phone.html' },
{ text: 'Random', link: '/api/random.html' },
{ text: 'System', link: '/api/system.html' },
{ text: 'Time', link: '/api/time.html' },
{ text: 'Unique', link: '/api/unique.html' },
{ text: 'Vehicle', link: '/api/vehicle.html' },
{ text: 'Word', link: '/api/word.html' },
Expand Down
6 changes: 0 additions & 6 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { faker } from '@faker-js/faker';

const randomName = faker.name.findName(); // Rowan Nikolaus
const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
const randomCard = faker.helpers.createCard(); // An object representing a random contact card containing many properties
```

### Browser
Expand All @@ -60,10 +59,6 @@ const randomCard = faker.helpers.createCard(); // An object representing a rando

// Rusty@arne.info
const randomEmail = faker.internet.email();

// An object representing a random contact card
// containing many properties
const randomCard = faker.helpers.createCard();
</script>
```

Expand All @@ -78,7 +73,6 @@ import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';

const randomName = faker.name.findName(); // Willie Bahringer
const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com
const randomCard = faker.helpers.createCard(); // random contact card containing many properties
```

:::tip Note
Expand Down
24 changes: 0 additions & 24 deletions src/faker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { LocaleDefinition } from './definitions';
import { FakerError } from './errors/faker-error';
import { deprecated } from './internal/deprecated';
import type { KnownLocale } from './locales';
import { Address } from './modules/address';
import { Animal } from './modules/animal';
Expand All @@ -23,7 +22,6 @@ import { Name } from './modules/name';
import { Phone } from './modules/phone';
import { Random } from './modules/random';
import { System } from './modules/system';
import { Time } from './modules/time';
import { Unique } from './modules/unique';
import { Vehicle } from './modules/vehicle';
import { Word } from './modules/word';
Expand All @@ -50,8 +48,6 @@ export class Faker {

readonly definitions: LocaleDefinition = this.initDefinitions();

private _seedValue: number | number[];

readonly fake: Fake['fake'] = new Fake(this).fake;
readonly unique: Unique['unique'] = new Unique().unique;

Expand All @@ -78,7 +74,6 @@ export class Faker {
readonly name: Name = new Name(this);
readonly phone: Phone = new Phone(this);
readonly system: System = new System(this);
readonly time: Time = new Time();
readonly vehicle: Vehicle = new Vehicle(this);
readonly word: Word = new Word(this);

Expand All @@ -100,24 +95,6 @@ export class Faker {
this.localeFallback = opts.localeFallback || 'en';
}

/**
* The seed that was last set.
* Please note that generated values are dependent on both the seed and the number of calls that have been made since it was set.
*
* Use the `seed` function to set a new seed.
*
* @deprecated Use the return value of `faker.seed()` instead.
*/
public get seedValue(): number | number[] {
deprecated({
deprecated: 'faker.seedValue',
proposed: 'return value of faker.seed()',
since: '6.3.0',
until: '7.0.0',
});
return this._seedValue;
}

/**
* Creates a Proxy based LocaleDefinition that virtually merges the locales.
*/
Expand Down Expand Up @@ -235,7 +212,6 @@ export class Faker {
seed(
seed: number | number[] = Math.ceil(Math.random() * Number.MAX_SAFE_INTEGER)
): number | number[] {
this._seedValue = seed;
if (Array.isArray(seed) && seed.length) {
this.mersenne.seed_array(seed);
} else if (!Array.isArray(seed) && !isNaN(seed)) {
Expand Down
25 changes: 0 additions & 25 deletions src/modules/datatype/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Faker } from '../..';
import { FakerError } from '../../errors/faker-error';
import { deprecated } from '../../internal/deprecated';

/**
* Module to generate various primitive values and data types.
Expand Down Expand Up @@ -185,30 +184,6 @@ export class Datatype {
return !!this.number(1);
}

/**
* Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number.
*
* @param length Length of the generated number. Defaults to `1`.
*
* @see faker.datatype.hexadecimal()
*
* @example
* faker.datatype.hexaDecimal() // '0xb'
* faker.datatype.hexaDecimal(10) // '0xaE13F044fb'
*
* @deprecated
*/
hexaDecimal(length = 1): string {
deprecated({
deprecated: 'faker.datatype.hexaDecimal()',
proposed: 'faker.datatype.hexadecimal()',
since: 'v6.1.2',
until: 'v7.0.0',
});

return this.hexadecimal(length);
}

/**
* Returns a [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number.
*
Expand Down
9 changes: 4 additions & 5 deletions src/modules/finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,10 @@ export class Finance {
* // 'invoice transaction at Kilback - Durgan using card ending with ***(...4316) for UAH 783.82 in account ***16168663'
*/
transactionDescription(): string {
const transaction = this.faker.helpers.createTransaction();
const account = transaction.account;
const amount = transaction.amount;
const transactionType = transaction.type;
const company = transaction.business;
const amount = this.amount();
const company = this.faker.company.companyName();
const transactionType = this.transactionType();
const account = this.account();
const card = this.mask();
const currency = this.currencyCode();

Expand Down
Loading