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