Skip to content

Commit a0a0d2b

Browse files
committed
Faker 3.0.0
1 parent a50cdc1 commit a0a0d2b

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ $ npm install --save @fakerjs/faker
1818
```js
1919
import faker from '@fakerjs/faker';
2020

21-
faker.animal();
21+
faker().animal();
2222
//=> Snow Leopard
2323

24-
faker.gender();
24+
faker().gender();
2525
//=> Female
2626

27-
faker.profession();
27+
faker().profession();
2828
//=> Software Engineer
2929

3030
// etc...

index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,17 @@ interface OptionsUrl {
6161
interface OptionsGame {
6262
locale?: string;
6363
}
64-
interface OptionsFaker {
65-
locale?: string;
66-
}
6764
interface OptionsHouse {
6865
locale?: string;
6966
}
7067
interface OptionsSport {
7168
locale?: string;
7269
}
70+
interface OptionsFaker {
71+
locale?: string;
72+
}
7373
declare class Faker {
74+
_options?: OptionsFaker;
7475
boolean(): boolean;
7576
integer(options?: OptionsInteger): number;
7677
float(options?: OptionsFloat): number;

index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import house from '@fakerjs/house';
2424
import sport from '@fakerjs/sport';
2525

2626
class Faker {
27-
options = {};
27+
_options = {};
2828

2929
constructor(options) {
30-
this.options = options || {};
30+
this._options = options || {};
3131
}
3232

3333
boolean() {
@@ -47,39 +47,39 @@ class Faker {
4747
}
4848

4949
gender(options) {
50-
return gender({locale: this.options.locale || 'en_US', ...options});
50+
return gender({locale: this._options.locale || 'en_US', ...options});
5151
}
5252

5353
ip() {
5454
return ip();
5555
}
5656

5757
letter(options) {
58-
return letter({locale: this.options.locale || 'en_US', ...options});
58+
return letter({locale: this._options.locale || 'en_US', ...options});
5959
}
6060

6161
string(options) {
6262
return string(options);
6363
}
6464

6565
profession(options) {
66-
return profession({locale: this.options.locale || 'en_US', ...options});
66+
return profession({locale: this._options.locale || 'en_US', ...options});
6767
}
6868

6969
animal(options) {
70-
return animal({locale: this.options.locale || 'en_US', ...options});
70+
return animal({locale: this._options.locale || 'en_US', ...options});
7171
}
7272

7373
game(options) {
74-
return game({locale: this.options.locale || 'en_US', ...options});
74+
return game({locale: this._options.locale || 'en_US', ...options});
7575
}
7676

7777
house(options) {
78-
return house({locale: this.options.locale || 'en_US', ...options});
78+
return house({locale: this._options.locale || 'en_US', ...options});
7979
}
8080

8181
sport(options) {
82-
return sport({locale: this.options.locale || 'en_US', ...options});
82+
return sport({locale: this._options.locale || 'en_US', ...options});
8383
}
8484

8585
superhero() {
@@ -107,11 +107,11 @@ class Faker {
107107
}
108108

109109
firstName(options) {
110-
return firstName({locale: this.options.locale || 'en_US', ...options});
110+
return firstName({locale: this._options.locale || 'en_US', ...options});
111111
}
112112

113113
lastName(options) {
114-
return lastName({locale: this.options.locale || 'en_US', ...options});
114+
return lastName({locale: this._options.locale || 'en_US', ...options});
115115
}
116116

117117
browser() {

0 commit comments

Comments
 (0)