Skip to content

Commit 30b40ad

Browse files
authored
docs: minor enhancements (#2131)
1 parent 23eb0f5 commit 30b40ad

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

docs/guide/index.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ You can run Faker in the Browser, within Node, or the many other languages suppo
2121

2222
Install it as a Dev Dependency using your favorite package manager.
2323

24-
```shell
24+
::: code-group
25+
26+
```shell [npm]
2527
npm install @faker-js/faker --save-dev
2628
```
2729

28-
or
30+
```shell [pnpm]
31+
pnpm add @faker-js/faker --save-dev
32+
```
2933

30-
```shell
34+
```shell [yarn]
3135
yarn add @faker-js/faker --dev
3236
```
3337

34-
or
35-
36-
```shell
37-
pnpm add @faker-js/faker --save-dev
38-
```
38+
:::
3939

4040
## Community
4141

docs/guide/localization.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { faker } from '@faker-js/faker/locale/de';
2828

2929
This will then just load the German locales with additional English locales as fallback. The fallback is required due to not all locales containing data for all features. If you encounter a missing locale entry in your selected language, feel free to open a Pull Request fixing that issue.
3030

31-
::: info
31+
::: info Info
3232
The English locales are around 600 KB in size.
3333
All locales together are around 5 MB in size.
3434
:::
@@ -159,6 +159,7 @@ The recommended way to access Faker instances is by using one of the individual
159159

160160
```ts
161161
import { allFakers, allLocales } from '@faker-js/faker';
162+
162163
console.dir(allFakers['de_AT']); // the prebuilt Faker instance for de_AT
163164
console.dir(allLocales['de_AT']); // the raw locale definitions for de_AT
164165
```
@@ -167,6 +168,7 @@ This could be useful if you want to enumerate all locales, for example:
167168

168169
```ts
169170
import { allFakers } from '@faker-js/faker';
171+
170172
for (let key of Object.keys(allFakers)) {
171173
try {
172174
console.log(

docs/guide/usage.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@
44

55
Using Faker is as easy as importing it from `@faker-js/faker`.
66

7-
```js
7+
::: code-group
8+
9+
```js [esm]
810
import { faker } from '@faker-js/faker';
911
// or, if desiring a different locale
10-
// import { fakerDE as faker } from '@faker-js/faker'
12+
// import { fakerDE as faker } from '@faker-js/faker';
13+
1114
const randomName = faker.person.fullName(); // Rowan Nikolaus
1215
const randomEmail = faker.internet.email(); // [email protected]
1316
```
1417

15-
Or if you're using CommonJS:
16-
17-
```js
18+
```js [cjs]
1819
const { faker } = require('@faker-js/faker');
20+
// or, if desiring a different locale
21+
// const { fakerDE: faker } = require('@faker-js/faker');
1922

2023
const randomName = faker.person.fullName(); // Rowan Nikolaus
2124
const randomEmail = faker.internet.email(); // [email protected]
2225
```
2326

27+
:::
28+
2429
For more information about changing and customizing the locales, please refer to our [Localization Guide](localization).
2530

2631
## Browser
@@ -119,7 +124,7 @@ or alternatively you can set a default reference date for all these methods:
119124

120125
```ts
121126
// affects all future faker.date.* calls
122-
faker.defaultRefDate = '2023-01-01T00:00:00.000Z';
127+
faker.setDefaultRefDate('2023-01-01T00:00:00.000Z');
123128
```
124129

125130
## Create complex objects
@@ -220,7 +225,7 @@ But, in most use-cases, this would be desirable.
220225

221226
Faker has your back, with another helper method:
222227

223-
```ts {7-9}
228+
```ts {7-10}
224229
import { faker } from '@faker-js/faker';
225230

226231
function createRandomUser(): User {

0 commit comments

Comments
 (0)