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

docs: browser console usage guide #2919

Merged
merged 6 commits into from
May 30, 2024
Merged
Changes from 1 commit
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
15 changes: 13 additions & 2 deletions docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz

:::

For more information about changing and customizing the locales, please refer to our [Localization Guide](localization).
For more information on selecting and customizing a locale, please refer to our [Localization Guide](localization).

## Browser

Expand All @@ -46,6 +46,17 @@ For more information about changing and customizing the locales, please refer to
Using the browser is great for experimenting 👍. However, due to all of the strings Faker uses to generate fake data, **Faker is a large package**. It's `> 5 MiB` minified. **Please avoid deploying the full Faker in your web app.**
:::

## Browser Console
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved

If you want to try it yourself, you can open your browser console via `Ctrl + Shift + J` / `F12`.

```js
const { faker } = await import('https://esm.sh/@faker-js/faker');

const randomName = faker.person.fullName(); // Amber Keebler
const randomEmail = faker.internet.email(); // Norma13@hotmail.com
```

## CDN/Deno

```js
Expand All @@ -56,7 +67,7 @@ const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com
```

::: info Note
It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://esm.sh/@faker-js/faker@v8.4.0"`.
It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://esm.sh/@faker-js/faker@v8.4.1"`.
ST-DDT marked this conversation as resolved.
Show resolved Hide resolved
:::

### Alternative CDN links
Expand Down