Skip to content

Commit

Permalink
refactor: get rid of export =
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Apr 21, 2022
1 parent 7e21de2 commit cb28b85
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Faker supports incremental loading of locales.

```js
// loads only de locale
const faker = require('@faker-js/faker/locale/de');
const { faker } = require('@faker-js/faker/locale/de');
```

## Setting a randomness seed
Expand Down
2 changes: 1 addition & 1 deletion docs/api/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ In a production environment, you may only want to include the locale data for a

```js
// loads only de locale
const faker = require('@faker-js/faker/locale/de');
const { faker } = require('@faker-js/faker/locale/de');
```
8 changes: 4 additions & 4 deletions test/locale-imports.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import allLocales from '../src/locales';

describe('locale imports', () => {
for (const locale in allLocales) {
it(`should be possible to directly require('@faker-js/faker/locale/${locale}').default`, () => {
it(`should be possible to directly require('@faker-js/faker/locale/${locale}')`, () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const faker = require(`../dist/cjs/locale/${locale}`).default;
const { faker } = require(`../dist/cjs/locale/${locale}`);

expect(faker).toBeDefined();
expect(faker.locale).toBe(locale);
});

// Internal test to cover `src/locale/*.ts`
it(`should be possible to directly require('../locale/${locale}').default`, () => {
it(`should be possible to directly require('../locale/${locale}')`, () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const faker = require(`../locale/${locale}`).default;
const { faker } = require(`../locale/${locale}`);

expect(faker).toBeDefined();
expect(faker.locale).toBe(locale);
Expand Down

0 comments on commit cb28b85

Please sign in to comment.