aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commerce
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/commerce')
-rw-r--r--src/modules/commerce/index.ts12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/commerce/index.ts b/src/modules/commerce/index.ts
index 89f47711..f0068415 100644
--- a/src/modules/commerce/index.ts
+++ b/src/modules/commerce/index.ts
@@ -1,4 +1,5 @@
import type { Faker } from '../../faker';
+import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions';
import { deprecated } from '../../internal/deprecated';
/**
@@ -14,16 +15,7 @@ import { deprecated } from '../../internal/deprecated';
*/
export class CommerceModule {
constructor(private readonly faker: Faker) {
- // Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(
- CommerceModule.prototype
- ) as Array<keyof CommerceModule | 'constructor'>) {
- if (name === 'constructor' || typeof this[name] !== 'function') {
- continue;
- }
-
- this[name] = this[name].bind(this);
- }
+ bindThisToMemberFunctions(this);
}
/**