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