diff options
Diffstat (limited to 'src/modules/location')
| -rw-r--r-- | src/modules/location/index.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index ce556de5..cdfa44d0 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -1,5 +1,6 @@ import type { Faker } from '../..'; import { FakerError } from '../../errors/faker-error'; +import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions'; import { deprecated } from '../../internal/deprecated'; /** @@ -15,16 +16,7 @@ import { deprecated } from '../../internal/deprecated'; */ export class LocationModule { constructor(private readonly faker: Faker) { - // Bind `this` so namespaced is working correctly - for (const name of Object.getOwnPropertyNames( - LocationModule.prototype - ) as Array<keyof LocationModule | 'constructor'>) { - if (name === 'constructor' || typeof this[name] !== 'function') { - continue; - } - - this[name] = this[name].bind(this); - } + bindThisToMemberFunctions(this); } /** |
