Skip to content

Commit

Permalink
refactor!: remove deprecations (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 4, 2022
1 parent 100a1ea commit 683ee34
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 1,853 deletions.
1 change: 0 additions & 1 deletion docs/.vitepress/api-pages.ts
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
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
@@ -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
@@ -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
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

0 comments on commit 683ee34

Please sign in to comment.