diff options
| author | Shinigami <[email protected]> | 2023-07-18 07:23:26 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-07-18 05:23:26 +0000 |
| commit | 5f947cbd4773f768a90243e54fd707c9769e8530 (patch) | |
| tree | 6fa92071b458fc6a56e7e2f09ed99c07e504ffb8 /src/modules/system | |
| parent | a3a1480cb3ad9301b4e5e53ba8a281d1e170bca5 (diff) | |
| download | faker-5f947cbd4773f768a90243e54fd707c9769e8530.tar.xz faker-5f947cbd4773f768a90243e54fd707c9769e8530.zip | |
chore: enable strictBindCallApply (#2254)
Diffstat (limited to 'src/modules/system')
| -rw-r--r-- | src/modules/system/index.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts index a4cf6745..4e5b5574 100644 --- a/src/modules/system/index.ts +++ b/src/modules/system/index.ts @@ -1,4 +1,5 @@ import type { Faker } from '../..'; +import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions'; const commonFileTypes = ['video', 'audio', 'image', 'text', 'application']; @@ -37,16 +38,7 @@ const CRON_DAY_OF_WEEK = [ */ export class SystemModule { constructor(private readonly faker: Faker) { - // Bind `this` so namespaced is working correctly - for (const name of Object.getOwnPropertyNames( - SystemModule.prototype - ) as Array<keyof SystemModule | 'constructor'>) { - if (name === 'constructor' || typeof this[name] !== 'function') { - continue; - } - - this[name] = this[name].bind(this); - } + bindThisToMemberFunctions(this); } /** |
