Skip to content

Commit

Permalink
Faker 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Jan 23, 2022
1 parent f4c151e commit 038679e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<a name="2.8.0"></a>
# [2.8.0](https://github.com/faker-javascript/faker) (2022-01-23)
* Added new method `tld` to generate fake tld value.
* Added new method `browser` to generate fake browser value.
* Added new method `url` to generate fake url value.

<a name="2.7.0"></a>
# [2.7.0](https://github.com/faker-javascript/faker) (2022-01-19)
* Added new method `firstname` to generate fake first name value.
Expand Down
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ interface OptionsFirstname {
interface OptionsLastname {
locale?: string;
}
interface OptionsUrl {
protocol?: string;
tld?: string;
}
declare class Faker {
boolean(): boolean;
integer(options?: OptionsInteger): number;
Expand All @@ -70,6 +74,9 @@ declare class Faker {
sentence(options?: OptionsSentence): string;
paragraph(options?: OptionsParagraph): string;
domain(options?: OptionsDomain): string;
url(options?: OptionsUrl): string;
browser(): string;
tld(): string;
email(options?: OptionsEmail): string;
firstName(options?: OptionsFirstname): string;
lastName(options?: OptionsLastname): string;
Expand Down
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import word from '@fakerjs/word';
import sentence from '@fakerjs/sentence';
import paragraph from '@fakerjs/paragraph';
import domain from '@fakerjs/domain';
import url from '@fakerjs/url';
import tld from '@fakerjs/tld';
import browser from '@fakerjs/browser';
import email from '@fakerjs/email';
import firstName from '@fakerjs/firstname';
import lastName from '@fakerjs/lastname';
Expand Down Expand Up @@ -89,6 +92,18 @@ class Faker {
lastName(options) {
return lastName(options);
}

browser() {
return browser();
}

url(options) {
return url(options);
}

tld() {
return tld();
}
}

const faker = new Faker();
Expand Down
3 changes: 3 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ expectType<string>(faker.word());
expectType<string>(faker.sentence());
expectType<string>(faker.paragraph());
expectType<string>(faker.domain());
expectType<string>(faker.url());
expectType<string>(faker.tld());
expectType<string>(faker.browser());
expectType<string>(faker.email());
expectType<string>(faker.firstName());
expectType<string>(faker.lastName());
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fakerjs/faker",
"version": "2.7.0",
"version": "2.8.0",
"description": "A set of javascript packages that generates fake data for you.",
"license": "MIT",
"repository": "faker-javascript/faker",
Expand Down Expand Up @@ -53,6 +53,9 @@
"@fakerjs/sentence": "^1",
"@fakerjs/paragraph": "^1",
"@fakerjs/domain": "^1",
"@fakerjs/tld": "^1",
"@fakerjs/browser": "^1",
"@fakerjs/url": "^1",
"@fakerjs/email": "^1",
"@fakerjs/firstname": "^1",
"@fakerjs/lastname": "^1"
Expand Down
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,15 @@ test('faker firstName return type to be string', t => {
test('faker lastName return type to be string', t => {
t.is(typeof faker.lastName(), 'string');
});

test('faker url return type to be string', t => {
t.is(typeof faker.url(), 'string');
});

test('faker tld return type to be string', t => {
t.is(typeof faker.tld(), 'string');
});

test('faker browser return type to be string', t => {
t.is(typeof faker.browser(), 'string');
});

0 comments on commit 038679e

Please sign in to comment.