diff options
Diffstat (limited to 'src/modules/hacker')
| -rw-r--r-- | src/modules/hacker/index.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/hacker/index.ts b/src/modules/hacker/index.ts index 95084832..7513095a 100644 --- a/src/modules/hacker/index.ts +++ b/src/modules/hacker/index.ts @@ -1,4 +1,5 @@ import type { Faker } from '../..'; +import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions'; /** * Module to generate hacker/IT words and phrases. @@ -17,16 +18,7 @@ import type { Faker } from '../..'; */ export class HackerModule { constructor(private readonly faker: Faker) { - // Bind `this` so namespaced is working correctly - for (const name of Object.getOwnPropertyNames( - HackerModule.prototype - ) as Array<keyof HackerModule | 'constructor'>) { - if (name === 'constructor' || typeof this[name] !== 'function') { - continue; - } - - this[name] = this[name].bind(this); - } + bindThisToMemberFunctions(this); } /** |
