From cb28b859d5d35f535e4ef91d7ca81c1627006fd2 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Thu, 21 Apr 2022 16:51:39 +0200 Subject: [PATCH] refactor: get rid of export = --- README.md | 2 +- docs/api/localization.md | 2 +- test/locale-imports.spec.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1750d77eede..d49d69c5fc3 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/api/localization.md b/docs/api/localization.md index 375e5e54bad..1810868cad6 100644 --- a/docs/api/localization.md +++ b/docs/api/localization.md @@ -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'); ``` diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index b0ccb2a2c7d..4856c34aa7d 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -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);